Enemy Spawning Error

Hi everyone I’m getting error in this section and I couldn’t think how to solve this problem.
As you can see below before the boolean code (isTimeToSpawn) my enemies were spawning in wrong places. I really didnt understand how it happened but I said okay lets continue and finished the script. After I finished, It was worse because now they even didnt spawn.


Before boolean code


after boolean code (isTiimeToSpawn)

And from every spawner lane I keep taking the same error:

NullReferenceException: Object reference not set to an instance of an object
Spawner.isTimeToSpawn (UnityEngine.GameObject attackerGameObject) (at Assets/Scripts/Spawner.cs:32)
Spawner.Update () (at Assets/Scripts/Spawner.cs:14)

However in script there is no difference from the section’s one.

Apparently solution came really interesting. One of my assets has more than one part so I gave all of them also another empty game object called body. Problem was SeenEverySecond couldnt take the values because prefab was not directly connected with the script.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms