Force awakening if needed for Singleton

This commit is contained in:
Antoine H 2021-01-19 10:46:07 +01:00
parent a940cb64ba
commit aa850a7c0b
4 changed files with 15 additions and 10 deletions

View file

@ -6,12 +6,13 @@ using UnityEngine;
//TODO : Update check stock of registered workshops
public sealed class StockManager : MonoBehaviour
{
public static string StockManager_path="/GameSystem/StockManager";
//Singleton
private static StockManager _instance=null;
public static StockManager Instance { get
{
if(_instance is null)
Debug.LogError("Missing StockManager instance");
if(_instance is null) //Force Awakening if needed
GameObject.Find(StockManager_path).GetComponent<StockManager>().Awake();
return _instance;
}
}