x


enable scripts/ components on other gameobjects for a different gameobject?

i want to be able to turn a script on remotely from a script on a gameobject other than the main gameobject- how?

more ▼

asked Sep 08 '10 at 02:40 PM

Fishman92 gravatar image

Fishman92
2.4k 101 113 128

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

1 answer: sort newest

You should set the enabled flag on your component to false like this:

var targetObj : GameObject;
targetObj.GetComponent(yourComp).enabled = false;
more ▼

answered Sep 08 '10 at 05:36 PM

AliAzin gravatar image

AliAzin
2.5k 42 56 79

thanks very much :)

Sep 08 '10 at 06:09 PM Fishman92
(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:

x5081
x3331
x2087
x134

asked: Sep 08 '10 at 02:40 PM

Seen: 4061 times

Last Updated: Sep 08 '10 at 02:40 PM