Example #1
0
    // Use Awake for initialization (setting up components etc.)
    private void Awake()
    {
        // SINGLETON
        if (gmI == null)
        {
            gmI = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
            return;
        }
        UI             = GetComponent <UI_Container>();
        InputContainer = GetComponent <Input_Container>();
        audioManager   = GetComponent <AudioManager>();

#if (UNITY_EDITOR)
        if (!UI)
        {
            Debug.LogError("GameManager is missing a UI_Container!");
        }
        if (!InputContainer)
        {
            Debug.LogError("GameManager is missing an Input_Container!");
        }
        if (!audioManager)
        {
            Debug.LogError("GameManager is missing an AudioManager!");
        }
#endif
    }
Example #2
0
 void Awake()
 {
     inventoryGO  = GameObject.Find("Ultimate Inventory Pro");
     inv          = inventoryGO.GetComponent <UI_Inventory>();
     itemList     = inventoryGO.GetComponent <UI_ItemsList>();
     eventManager = inventoryGO.GetComponent <UI_EventManager>();
     hotbar       = inventoryGO.GetComponent <UI_Hotbar>();
     if (playerEquipGO == null)
     {
         playerEquipGO = GameObject.Find("PlayerEquipment");
     }
     playerEquipment = playerEquipGO.GetComponent <UI_PlayerEquipment>();
     conScript       = container.GetComponent <UI_Container>();
 }