- Home /
How Do i Enable an Object and then Disable it?
Hey Guys, How do i make a object enable by pressing the E key and then making it disable by pressing the E key again please help thank you :)
Answer by FreeTimeDev · Oct 17, 2010 at 06:55 AM
One way to do it (I'm sure there are better)
Imagine a button for a door, for example's sake:
Button on a wall that has a child object of an empty gameObject, that's a trigger.
When the player presses e, he sends a message (that doesn't require a reciever) that says "useSomething". When the trigger receives said message, it then sends the required variable change (Boolean might work well; doors are only open or closed, typically).
I forgot to mention, that using Switch(booleanName) might be something you're looking for, but I'm not an API expert by a long shot and I didn't do the research.
Your answer
Follow this Question
Related Questions
Disable a GameObjects scripts knowing only the GameObjects name 3 Answers
A node in a childnode? 1 Answer
[solved]how can i enable or disable a component of instantiated objects? 5 Answers
error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer 3 Answers
image not enabling 0 Answers