Merge d5ddb2eea3
into b870d64b57
commit
fd84aa7079
|
@ -248,6 +248,8 @@ namespace Coffee.UISoftMask
|
|||
#if UNITY_EDITOR
|
||||
s_GameVPId = Shader.PropertyToID("_GameVP");
|
||||
s_GameTVPId = Shader.PropertyToID("_GameTVP");
|
||||
UnityEditor.SceneView.beforeSceneGui -= SceneView_beforeSceneGui; // For safety
|
||||
UnityEditor.SceneView.beforeSceneGui += SceneView_beforeSceneGui;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -269,6 +271,9 @@ namespace Coffee.UISoftMask
|
|||
|
||||
MaterialCache.Unregister(_effectMaterialHash);
|
||||
_effectMaterialHash = k_InvalidHash;
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.SceneView.beforeSceneGui -= SceneView_beforeSceneGui;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
@ -301,8 +306,11 @@ namespace Coffee.UISoftMask
|
|||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
private void SceneView_beforeSceneGui(UnityEditor.SceneView obj)
|
||||
{
|
||||
|
||||
var parentCanvas = GetComponentInParent<Canvas>(); // Don't think we can cache this in case this go is moved to another parent
|
||||
if (parentCanvas != null && parentCanvas.enabled) // Only do this expensive call if the UI element is active
|
||||
UpdateMaterialForSceneView(modifiedMaterial);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue