void Awake() { if (Toolbox._instance != null) { Destroy(this.gameObject); } manager = GameObject.FindGameObjectWithTag("Manager"); if (manager != null) { Debug.Log(manager); } gameManager = manager.GetComponent <GameworldManager>(); inventory = manager.GetComponent <Inventory>(); equip = manager.GetComponent <EquipManager>(); eInventory = manager.GetComponent <EnemyInventory>(); stats = manager.GetComponent <StatsManager>(); if (manager == null) { var go = new GameObject("Manager"); go.transform.parent = this.gameObject.transform; go.AddComponent <StatsManager>(); go.AddComponent <GameworldManager>(); go.AddComponent <Inventory>(); go.AddComponent <EquipManager>(); go.AddComponent <EnemyInventory>(); go.AddComponent <SavePlayerPrefs>(); } }
// Start is called before the first frame update void Start() { stats = Toolbox.GetInstance().GetStats().GetComponent <StatsManager>(); manager = Toolbox.GetInstance().GetManager().GetComponent <GameworldManager>(); inventory = Toolbox.GetInstance().GetInventory().GetComponent <Inventory>(); equipManager = Toolbox.GetInstance().GetEquip().GetComponent <EquipManager>(); eInventory = Toolbox.GetInstance().GeteInventory().GetComponent <EnemyInventory>(); LoadPrefs(); }