x


Call function in another script?

What do I use to call a function in another script?

more ▼

asked Jun 11 '12 at 01:30 AM

JBoy gravatar image

JBoy
87 19 31 34

This question has also been asked and answered MANY MANY MANY times before. Execute a search using:

"call function script"

And see if you can count how many times its been asked before.

Jun 11 '12 at 02:57 AM kolban
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

In C#, you call

ScriptName scriptName = this.gameObject.GetComponent<ScriptName>();

under Update() then check/edit stuff under scriptName.whatever. No idea how it works in UnityScript.

Feel free to change this.gameObject to whichever object you attached the code to.

more ▼

answered Jun 11 '12 at 01:41 AM

burnpsy gravatar image

burnpsy
149 10 18 20

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

x3329
x478
x76
x21

asked: Jun 11 '12 at 01:30 AM

Seen: 1212 times

Last Updated: Jun 11 '12 at 02:57 AM