x


How do I assign script as a variable in the inspector?

I have a game object with a script attached. One of the scripts variables needs to be a javascript (monoscript) file so that I can drag different scripts in there hit run and the script is excecuted at runtime. I have this working fine using myCustomSCript:MonoScript but when I try to build the project I get errors. I understand that MonoScript is an editor script and I tried using MonoBehaviour but that doesnt allow me to drag a custom script into the inspector. Anyone know how to do this???

more ▼

asked Mar 19 '12 at 06:49 PM

grimmy gravatar image

grimmy
302 23 34 43

Contemplate what you are asking. What is a "script"? An instance of a class?

Mar 19 '12 at 07:02 PM Jessy
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

MonoBehaviour is the usual type for scripts.

If it's a variable on something, you need to make sure the script is also in the scene - you can't drag a script from the project straight into a variable.

more ▼

answered Mar 19 '12 at 07:07 PM

davedx gravatar image

davedx
138 1 1 3

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

x3331
x823
x467
x4

asked: Mar 19 '12 at 06:49 PM

Seen: 892 times

Last Updated: Mar 19 '12 at 07:07 PM