(Issue) WalkerBoys - Accessing gameObjects through Inspector

Hi All,

First time posting in Unity and from username, I am pretty new.

So I came across the WalkerBoys website and I am currently watching this video

http://vimeo.com/channels/151501/17069203

I have gotten through to 9:40 on it. Basically I have assigned a script to the sphere and also the cube.

In the Sphere my script called Accessing_GameObjectssays the following:

// Accessing game objects

// 1 - Through the inspector

var otherGameObject = 10;

function printOther(t:String)
{
	print("Function has a value of " +otherGameObject);
	print (t);
}

My Code in the Cube has the following:

var target:Accessing_GameObjects;


function Update () 

{
target.printOther("This is the other objects sript");
}

Now i get this error:

NullReferenceException: Object reference not set to an instance of an object
javascript_api.Update () (at Assets/javascript_api.js:104)

Any help would be greatly appreciated.

Thanks in Advance

SOLVED!!

Solution - Didnt drag the sphere in as a target!

Hi,

Nice catch. :slight_smile: And thank!