Why does spawning an actor cause error?

what error? where?

Anyone know why this is causing an error when I play? It is located in my Gamemode blueprint and spawns an ammo actor at certain locations every 30 seconds.

Oh sorry. Here is where and what the errors are:

Hey there
and AHHH, DON’T add a 30 Second Delay to your TICK function!

For things like these TIMERS exist!

Do it like this please:

http://puu.sh/omP1g/02822bd3ce.png

The TimeHandle can be used to stop the Timer or get the Time from it, etc.

For your Problem with the Error:

Random Integer in Range returns a value from Min to Max. INCLUDING Min and Max.

That means, it will include the Max that you passed with the LENGTH of the Array.

Why is that bad/wrong?

Array Length is always the AMOUNT of Elements in the Array, but we actually count from 0 to LENGTH - 1.

So if the Random Function grabs the LENGTH as an index, you are going out of bounds!

How to fix that?

Use LENGTH - 1 for the Max input. Or use LAST INDEX instead of LENGTH.

Hope that helps (:

Cheers!