void Start() { playerGameObject = GameObject.FindGameObjectWithTag("Player"); playerMovementScript = playerGameObject.GetComponent <PlayerMovement>(); canvas = GameObject.FindGameObjectWithTag("Canvas"); craftingObject = canvas.transform.Find("UI_Crafting").gameObject; crafting = craftingObject.GetComponent <UI_Crafting>(); }
protected override void Awake() { base.Awake(); if (Enable) { CraftingWindowComponent = GetComponentInParent <UI_Crafting> (); if (!CraftingWindowComponent) { Debug.LogError("UI_Crategory: Crafting window component is null"); } } }
private void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { bool isActiveUI = false; foreach (GameObject ui in togglableUIs) { UI_TogglableInventory inventory = ui.GetComponent <UI_TogglableInventory>(); UI_Crafting crafting = ui.GetComponent <UI_Crafting>(); if (inventory != null && inventory.isActive) { isActiveUI = true; break; } else if (crafting != null && crafting.isActive) { isActiveUI = true; break; } } if (isActiveUI) { foreach (GameObject ui in togglableUIs) { UI_TogglableInventory inventory = ui.GetComponent <UI_TogglableInventory>(); UI_Crafting crafting = ui.GetComponent <UI_Crafting>(); if (inventory != null && inventory.isActive) { inventory.Toggle(); } else if (crafting != null && crafting.isActive) { crafting.Toggle(); } } } else { pauseMenu.Toggle(); } } }
void Awake() { craft = GameObject.Find("Ultimate Inventory Pro").GetComponent <UI_Crafting>(); //assign inv GO at once }
private void Awake() { rectTransform = GetComponent <RectTransform>(); uI_Crafting = FindObjectOfType <UI_Crafting>(); }
void Awake() { //assign crafting and itemslist scripts craft = inv.GetComponent <UI_Crafting>(); items = inv.GetComponent <UI_ItemsList>(); }