From a748adf1bde5e400fcc84ec902a1438867105f75 Mon Sep 17 00:00:00 2001 From: mob-sakai <12690315+mob-sakai@users.noreply.github.com> Date: Thu, 27 Feb 2025 09:32:56 +0900 Subject: [PATCH] fix: fix potential issues --- .../Runtime/Internal/Extensions/ComponentExtensions.cs | 2 +- .../src/Runtime/Internal/Utilities/PowerRangeAttribute.cs | 2 ++ Packages/src/Runtime/UIEffectBase.cs | 8 +------- 3 files changed, 4 insertions(+), 8 deletions(-) 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