x


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 :)

more ▼

asked Oct 17 '10 at 03:59 AM

MC HALO gravatar image

MC HALO
878 74 94 111

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

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).

more ▼

answered Oct 17 '10 at 06:55 AM

FreeTimeDev gravatar image

FreeTimeDev
408 14 20 30

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.

Oct 17 '10 at 06:55 AM FreeTimeDev

Hey Matthew thank you very much :)

Oct 18 '10 at 01:54 AM MC HALO
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3753
x216
x135

asked: Oct 17 '10 at 03:59 AM

Seen: 1240 times

Last Updated: Oct 17 '10 at 04:42 AM