From a3649c65b0e7f2bc06e840ab91b2628a2ca48dff Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Wed, 10 Sep 2025 09:10:58 +0200 Subject: [PATCH] Touch-up some warnings in IntroCinematicsPlayer --- Assets/Scripts/UI/IntroCinematicsPlayer.cs | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/UI/IntroCinematicsPlayer.cs b/Assets/Scripts/UI/IntroCinematicsPlayer.cs index f31ecbd5..43f71dbf 100644 --- a/Assets/Scripts/UI/IntroCinematicsPlayer.cs +++ b/Assets/Scripts/UI/IntroCinematicsPlayer.cs @@ -1,41 +1,42 @@ using UnityEngine; using UnityEngine.Playables; +using UnityEngine.Serialization; using UnityEngine.UI; public class IntroCinematicsPlayer : MonoBehaviour { - public bool ShouldPlayIntro; - private Image introRenderer; - private PlayableDirector director; + [FormerlySerializedAs("ShouldPlayIntro")] public bool shouldPlayIntro; + private Image _introRenderer; + private PlayableDirector _director; - private Animator animation; + private Animator _animatorComponent; void OnEnable() { // Get the director and subscribe to when it stops playing - director = GetComponent(); - introRenderer = GetComponent(); - director.stopped += OnPlayableDirectorStopped; - animation = GetComponent(); + _director = GetComponent(); + _introRenderer = GetComponent(); + _director.stopped += OnPlayableDirectorStopped; + _animatorComponent = GetComponent(); } // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { //Play the intro and unhide the Canvas object if intro is enabled - if (ShouldPlayIntro) + if (shouldPlayIntro) { - introRenderer.enabled = true; - director.Play(); - animation.enabled = true; + _introRenderer.enabled = true; + _director.Play(); + _animatorComponent.enabled = true; } ; //Disable the intro Canvas object if intro is disabled - if (!ShouldPlayIntro) + if (!shouldPlayIntro) { - director.Stop(); - introRenderer.enabled = false; - animation.enabled = false; + _director.Stop(); + _introRenderer.enabled = false; + _animatorComponent.enabled = false; } @@ -47,7 +48,7 @@ public class IntroCinematicsPlayer : MonoBehaviour void OnPlayableDirectorStopped(PlayableDirector aDirector) { // Disable the introsequence gameobject when intro is finished playing - introRenderer.enabled = false; + _introRenderer.enabled = false; } // Update is called once per frame