So in Unity I'm making Snake, and to do that I've a list which houses all the tail elements from the Snake (this was implemented by the NoobTuts tutorial on snake just FYI).
I'm find with adding stuff and removing stuff from the list, HOWEVER, I do have an issue with part of the removal.
When I remove an object from the list it's still in the scene, it's just not acting with the rest of the objects still in the list. All I need to do, is just destroy that object.
I'm not sure if you can destroy an object in a list, or if that'll cause an issue, so I've been trying to set a gameobject to the value at the end of the list. However all list methods seem to just return the bloody index value, not the value in the index!
I've had a look through MSDN but can't understand parts of it.
Here's what I have:
else if (ateslow)
{
tailExcess = tail.Count - 1;
//tail.IndexOf(tail.Count - 1);
tail.RemoveAt(tail.Count-1);
ateslow = false;
if (snakeSpeed < minSnakeSpeed)
snakeSpeed += 0.0f;
}
So I play on having tailExcess equal the last element in the list, then I plan on destroying tailExcess after having it popped from the list. The rest below that doesn't matter.
What am I missing?