public void onKeyIsPickedUp (GameObject obj, bool tr ){ Interactable inter = obj.GetComponent<Interactable>(); if(inter != null && inter.getPuzzleState() == "notPickedUp"){ r_Key = inter; r_Key.setPuzzleState("pickedUp"); gameObject.GetComponentInChildren<Behaviour_DoorSimple>().unlockDoor(); } }