Unity Error: Argument is out of range. (Tut57-59)

During tutorial 57, if you hit tab after generating the spawn points for the Slugs, you will get an error. I looked for a way to fix it for a while, but it was covered in tutorial 58 (unknown to me at the time).

Error:
ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index


Where:
BurgZergArcade’s Hack n Slash Tutorial 57, 58. Targetting and Spawn Points.

Explanation:
It’s trying to get a list of mobs, but they haven’t spawned yet since we’re using the finite state engine to spawn the mobs instead.

Solution:
You want to add another AddAllEnemies() call to the TargetEnemy() function if you don’t have any Enemies in the list of targets. Tutorial 58 and the beginning of Tutorial 59 covers the details.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: