Add automatic Rive asset refresh workflow

This commit is contained in:
pelpanagiotis
2026-09-20 10:01:38 +03:00
parent d04ff998cb
commit c674d76549
45 changed files with 226275 additions and 248678 deletions
+33 -4
View File
@@ -9,6 +9,20 @@ public class MenuFadeIn : MonoBehaviour
CanvasGroup _group;
Coroutine _fadeRoutine;
bool _started;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void ReactivateFadeImages()
{
var fadeComponents = Resources.FindObjectsOfTypeAll<MenuFadeIn>();
foreach (var fadeComponent in fadeComponents)
{
if (!fadeComponent.gameObject.scene.IsValid())
continue;
fadeComponent.gameObject.SetActive(true);
}
}
void Awake()
{
@@ -16,6 +30,10 @@ public class MenuFadeIn : MonoBehaviour
_group = GetComponent<CanvasGroup>();
if (_group == null) _group = gameObject.AddComponent<CanvasGroup>();
var canvas = GetComponentInParent<Canvas>();
if (canvas != null)
canvas.transform.localScale = Vector3.one;
_group.alpha = 1f;
_group.blocksRaycasts = true;
Debug.Log("[MenuFadeIn] Awake - CanvasGroup ensured, alpha=1");
@@ -23,14 +41,26 @@ public class MenuFadeIn : MonoBehaviour
void OnEnable()
{
// Reset state whenever enabled and start the fade
if (_group == null) _group = GetComponent<CanvasGroup>() ?? gameObject.AddComponent<CanvasGroup>();
if (_started)
BeginFade();
}
void Start()
{
_started = true;
BeginFade();
}
void BeginFade()
{
_group.alpha = 1f;
_group.blocksRaycasts = true;
if (_fadeRoutine != null) StopCoroutine(_fadeRoutine);
_fadeRoutine = StartCoroutine(Fade());
Debug.Log("[MenuFadeIn] OnEnable - starting fade (delay=" + delay + ", duration=" + duration + ")");
Debug.Log("[MenuFadeIn] Starting fade (delay=" + delay + ", duration=" + duration + ")");
}
void OnDisable()
@@ -57,7 +87,6 @@ public class MenuFadeIn : MonoBehaviour
_group.alpha = 0f;
_group.blocksRaycasts = false;
Debug.Log("[MenuFadeIn] Fade finished - disabling GameObject");
gameObject.SetActive(false);
Debug.Log("[MenuFadeIn] Fade finished");
}
}