So in my game when a player presses a button it simulates a door opening and closing and when the button is clicked by the player the door opens and closes depending on its previous state. I would like to know how I would code the game to make it so when the button is clicked it sees if the door is closed or opened and then change it so it becomes the opposite and then changes the text of the button to fit to either show the player to close or open the door? I would also like to know how I would make the nodes in the game that the sprites use to move around the map will not go into the office if the door is closed? Thank you
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
102 People are following this question.
[Help] Event Trigger buttons not working?
How do I make my character jump by making a sound into my phone mic? (Using C#)
Problem with highlighting correct answer, any idea?
Help finishing code of a Jump button for touch devices/phones (public void Jump() works but doesn't make the character jump, not your typical how do I make my character jump in android question please give my code a look)