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 9 14 15

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

2 answers: sort voted first
more ▼

answered Oct 14, 2012 at 12:13 PM

Fattie gravatar image

Fattie
27k 321 678 401

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

var OtherComponent : Component ;

OtherComponent = gameObject.GetComponent ( ScriptName ) ;

more ▼

answered Oct 14, 2012 at 02:15 PM

Montraydavis gravatar image

Montraydavis
1.4k 3 5 13

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

x3475
x441
x326
x239
x184

asked: Oct 14, 2012 at 12:10 PM

Seen: 5051 times

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