Hi there, I'm trying to complete a tutorial that shows you how to use GetComponent to access a function inside another JS file. The code in my function Update() is:
GetComponent(Access_Me).printMe();
My other script file is named Access_Me and has the printMe() function that simply prints("successfully accessed").
So simple enough. However, when I try to run this, Unity gives me an error which says:
`NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType)
NewBehaviourScript 1.Update () (at Assets/NewBehaviourScript 1.js:3)
Also, after trying to run it, Unity becomes very sluggish and doesn't respond well to mouse clicks. Not sure whats going on, any ideas?
Thanks