- Home /
Help On error Please
Can anyone Help me with this error :
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.SetProperty (System.Object target, System.String name, System.Object value) ResPlaye1.Update () (at Assets/ResPlaye1.js:21)
here is the script:
var spawnPlayer1 : Transform; //drag your spawn point to here in the inspector - probably make it an empty gameobject so you can move it about on the diving board
//var MainPlayerPlayer2: GameObject;
var NewPlayerPrefab2 : Transform;
var MainPlayer11 : GameObject;
var MainCube : GameObject;
var MainBodyTrue: GameObject;
var MainHairTrue: GameObject;
function Update()
{
if(Input.GetKeyDown(KeyCode.M)){
//Destroy(MainPlayerPlayer2);
MainCube.SetActiveRecursively(false);
Instantiate(NewPlayerPrefab2,spawnPlayer1.position,spawnPlayer1.rotation);
MainPlayer11.SetActiveRecursively(true);
MainHairTrue.SetActiveRecursively(true);
MainBodyTrue.SetActiveRecursively(true);
GetComponent(NewMoveScript).active = true; // This line is causing the problem ?
}
}
Answer by StephanK · Nov 02, 2010 at 07:30 AM
You probably forgot to assign one of your variables in your script.
Your answer
![](https://koobas.hobune.stream/wayback/20220613081658im_/https://answers.unity.com/themes/thub/images/avi.jpg)