Unity Community,
I am working on a very simple game where all doors will open using a single key, in this case, spacebar. Here's the issue. I don't want them to open at the same time. I have a trigger box on the door and when the player enters the box a GUI Texture prompts them to press space to open. The door stays open even when the player leaves the trigger and will prompt again to close should they choose. However, EACH door on the level opens when any one of the triggers is activated.
How can I script it so that only the door that is attached to the trigger is the one that opens? Help! I'm at my wits end.
Current setup:
I'm using prefabs (the doors are different shapes, so a new prefab is needed for each door, which kind of defeats the purpose but neither way works so far)
I have a triggerDoor and doorObject script, which sets the trigger and door to recognize each other. But there is an issue with Unity using a globalVar instead of allowing me to use a localVar.
If someone has encountered this problem and knows a workaround, or can link me an existing thread where this issue has been solved, I would greatly appreciate it.
Thanks,
JV