x


Accessing other GameObjects Script Variables

Hi there! I am kinda new at this but i have a script here. But i always get a NullReferenceException Everytime i start up the Game :(. I want my Script to Access Other GameObject Variable.

Any Ideas to fix it :)?

  • Yohan
more ▼

asked Oct 14, 2012 at 12:10 PM

Yohan_Games gravatar image

Yohan_Games
11 10 15 16

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

2 answers: sort voted first

var OtherComponent : Component ;

OtherComponent = gameObject.GetComponent ( ScriptName ) ;

more ▼

answered Oct 14, 2012 at 02:15 PM

Montraydavis gravatar image

Montraydavis
1.5k 5 8 15

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

x3706
x465
x340
x251
x192

asked: Oct 14, 2012 at 12:10 PM

Seen: 5525 times

Last Updated: Oct 14, 2012 at 02:15 PM