Force awakening if needed for Singleton
This commit is contained in:
parent
a940cb64ba
commit
aa850a7c0b
4 changed files with 15 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue