I have a list of type gameobject, that stores the arrows that are fired towards outside the trigger zone. I wanted to make it so if there are more than 4 arrows fired, the game would start destroying the first one in the list every time after a fire from that point to not potentially butcher the performance. Then move every gameobject in the list one index up, and finally remove the last slot in the list. The problem comes up with the error message and idk how to fix it.
#ArgumentOutOfRangeException
1 messages · Page 1 of 1 (latest)
If it helps, I get this error the moment the 5th arrow leaves the trigger
IndexOfis slow. Why not use aforloop and save you that?- Always doing
- 1on the index means that you might end up with0 - 1, which will be out of range and likely cause the error you are experiencing.