optimise instance access

This commit is contained in:
2022-12-14 20:22:39 +01:00
parent 22458e6d18
commit 5e2af5468c
3 changed files with 20 additions and 39 deletions

View File

@@ -14,19 +14,8 @@ namespace EscapeRoomEngine.Engine.Runtime.UI
public class GameControl : MonoBehaviour
{
public static GameControl Instance
{
get
{
if (_foundGameControl == null)
{
_foundGameControl = FindObjectOfType<GameControl>();
}
return _foundGameControl;
}
}
private static GameControl _foundGameControl;
public static GameControl Instance { get; private set; }
[BoxGroup("Internal")] [SerializeField]
private Button startButton, stopButton, pauseButton, addTimeButton, removeTimeButton;
[BoxGroup("Internal")] [SerializeField]
@@ -41,6 +30,8 @@ namespace EscapeRoomEngine.Engine.Runtime.UI
private void Awake()
{
Instance = this;
_targetTime = Engine.Instance.initialTargetTime;
}