using UnityEngine; using UnityEngine.UI; namespace RR.Common.UI.FX { /// /// Автоматически добавляет базовые UI-эффекты к интерактивным элементам. /// [AddComponentMenu("RR/UI/FX/UI FX Runtime Installer")] public sealed class UIFXRuntimeInstaller : MonoBehaviour { private const string RuntimeObjectName = "UI FX Runtime Installer"; private static UIFXRuntimeInstaller _instance; [SerializeField, Min(0.1f)] private float scanInterval = 0.5f; private float _nextScanTime; [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] private static void Bootstrap() { if (_instance != null) { return; } GameObject installerObject = new(RuntimeObjectName); installerObject.AddComponent(); DontDestroyOnLoad(installerObject); } private void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); return; } _instance = this; DontDestroyOnLoad(gameObject); } private void Update() { if (Time.unscaledTime < _nextScanTime) { return; } _nextScanTime = Time.unscaledTime + scanInterval; InstallButtonGlow(); } private static void InstallButtonGlow() { Button[] buttons = FindObjectsByType