No, no enemy ever died twice.
The function was run twice because it would hit an error during the first execution.
I had a bit of code something like this:
- Code: Select all
while(list is not empty)
{
list.RemoveAtIndex(0);
list[0].DoThing();
}
Intending to do something to the top of the list, then remove it...
But the order there is very wrong.
Not only did it mean I was never grabbing the right element, it also means list[0].DoThing(); can come up null because the list may well be empty after the removal.
When Unity encounters an issue of that sort, it stops and restarts the function again... of course, for the second run, the list is already empty (since that's what causes the code to fail) so it just never enters that code. This second execution is why the explode message prints twice.
The statements should have been (and now are) in the opposite order: do what I want with the top of the list, then remove it.
The only reason it wasn't a complete disaster was that this was only used for trying to figure out a new group leader for the summoner's former stable. It probably does explain why that frequently seemed to not actually work according to player accounts.