I’ve gotten this script to spawn enemy in my scene, but I’m running into error that wont spawn the enemy I had set in variable.
var EnemySpawned : boolean;
var RespawnTime : float;
var Enemy : GameObject;
var SpawnNode : GameObject;
function Update () {
if (EnemySpawned == false) {
EnemySpawned = true;
EnemyRespawned ();
}
}
function SpawnEnemy () {
Instantiate(Enemy.SpawnNode.transform.position. Quaternion.identity);
}
function EnemyRespawned () {
yield WaitForSeconds(RespawnTime);
SpawnEnemy ();
}
This is the error code I got
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name)
UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
EnemySpawn.SpawnEnemy () (at Assets/Scripts-FPS/EnemySpawn.js:15)
EnemySpawn+$EnemyRespawned$2+$.MoveNext () (at Assets/Scripts-FPS/EnemySpawn.js:21)
Went over the script over and over again, cant seem to figure out what part of the script or inspector I need to fix.