Enemy wouldn't move after intantiate

Hi,

I’m very new to Unity and I got stuck at this part.


Apparently, it did spawn the enemy, but it didn’t move at all. I discovered that when it Instantiate enemy, it didn’t have any WaveConfig scriptable object at all.

I’ve re-check my code through Mr. Rick’s video and GitHub and found no differences at all.

Here is my code of EnemySpawner.cs, WaveConfig.cs, and EnemyPathing.cs



Hi Smickal,

Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.

Hope this helps :slight_smile:


See also;

Hi Nina,

Thanks for the suggestion and the solution, I’ve found the source of the problem and corrected my mistake.

Thanks for the helpp! :grin:

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

Privacy & Terms