- Home /
Question by
soyfeo123 · May 10 at 02:09 AM ·
if-statements
Code inside if statement not working
I am making a door lock for a chase that I am making, but I don't know why this code is not working.
Code:
public void UnlockOrLock()
{
if(inventory.itemHolding == InventorySys.ItemHolding.Key)
{
//itemMan.eToInteract.SetActive(false);
Debug.Log("has key");
locked = false;
inventory.EmptyInventory();
chaseMusic.Stop();
chaseMusic.clip = chaseContinueMusic;
chaseMusic.Play();
}
else
{
Debug.Log("Key needed to unlock");
}
}
Comment
U gotta show us ur whole code and paste it in as code pls so it gets the right format... so we need the full inventory and inventory sys script cuz so far everyth looks fine
Your answer
![](https://koobas.hobune.stream/wayback/20220613060354im_/https://answers.unity.com/themes/thub/images/avi.jpg)