diff --git a/Packages/src/Runtime/Internal/Extensions/ComponentExtensions.cs b/Packages/src/Runtime/Internal/Extensions/ComponentExtensions.cs index 9a59422..9a2b1f8 100644 --- a/Packages/src/Runtime/Internal/Extensions/ComponentExtensions.cs +++ b/Packages/src/Runtime/Internal/Extensions/ComponentExtensions.cs @@ -204,7 +204,7 @@ namespace Coffee.UIEffectInternal target.enabled = false; // Find MonoScript of the specified component. - foreach (var script in Resources.FindObjectsOfTypeAll()) + foreach (var script in MonoImporter.GetAllRuntimeMonoScripts()) { if (script.GetClass() != typeof(T)) { diff --git a/Packages/src/Runtime/Internal/Utilities/PowerRangeAttribute.cs b/Packages/src/Runtime/Internal/Utilities/PowerRangeAttribute.cs index ca269da..1a9726c 100644 --- a/Packages/src/Runtime/Internal/Utilities/PowerRangeAttribute.cs +++ b/Packages/src/Runtime/Internal/Utilities/PowerRangeAttribute.cs @@ -1,10 +1,12 @@ using System; +using System.Diagnostics; using UnityEditor; using UnityEngine; namespace Coffee.UIEffectInternal { [AttributeUsage(AttributeTargets.Field)] + [Conditional("UNITY_EDITOR")] public sealed class PowerRangeAttribute : PropertyAttribute { public readonly float min; diff --git a/Packages/src/Runtime/UIEffectBase.cs b/Packages/src/Runtime/UIEffectBase.cs index 585febe..79d0171 100644 --- a/Packages/src/Runtime/UIEffectBase.cs +++ b/Packages/src/Runtime/UIEffectBase.cs @@ -136,14 +136,8 @@ namespace Coffee.UIEffects protected override void OnValidate() { UpdateContext(context); - ApplyContextToMaterial(graphic ? graphic.canvasRenderer.GetMaterial() : _material); SetVerticesDirty(); SetMaterialDirty(); - - if (!EditorApplication.isPlaying) - { - EditorApplication.QueuePlayerLoopUpdate(); - } } protected override void Reset() @@ -170,7 +164,7 @@ namespace Coffee.UIEffects if (graphic) { graphic.SetVerticesDirty(); - GraphicProxy.Find(graphic).SetVerticesDirty(graphic, false); + GraphicProxy.Find(graphic).SetVerticesDirty(graphic, enabled); #if UNITY_EDITOR EditorApplication.QueuePlayerLoopUpdate(); #endif