optimise instance access
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user