x


How to execute and or reference other scripts?

How do you execute a script on a different GameObject and or its specific functions from within another script? Also how to connect scripts that are on different objects. Like for instance say I have a script for selecting stuff it can select anything in the game but it has ifs for each games tag, how then would I execute it to then use the functionality of a more specific script that has to do with what you selected?

more ▼

asked Aug 10, 2012 at 08:25 AM

cj31387 gravatar image

cj31387
161 97 970 110

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

1 answer: sort voted first

this is explained in incredible detail with literally dozens of examples on the unity web site

http://docs.unity3d.com/Documentation/ScriptReference/

notice the links "Accessing Other Components Accessing Other Game Objects"

If you ever have trouble finding unity documentation, using google just go "Unity3D documentation scripting reference other scripts"

more ▼

answered Aug 10, 2012 at 08:42 AM

Fattie gravatar image

Fattie
27.1k 324 678 401

And this has been asked dozen of times in Unity Answers. But it looks like that most users don't even bother using the search engine.

Aug 10, 2012 at 08:54 AM Kryptos
(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:

x803
x442
x28

asked: Aug 10, 2012 at 08:25 AM

Seen: 1139 times

Last Updated: Aug 10, 2012 at 08:54 AM