The question is answered, right answer was accepted
Destroy not working...
I've created a map editor that generates blueprint files that I pull in to build a layered, tiled map on game run. Everything works great... except that once I create a piece in the editor I can't get it to destroy a print section if the user doesn't want it. Each tile is in a list held in my blueprint class. If they try to delete it, its supposed to go into every tile in the list and run a kill function on all of them before removing itself from the list of blue prints. Everything works great except the part about the tiles being killed. It successfully removes itself from the working list of blueprints, but since the tiles still exist I just end up with a bunch of sections that are still in the editor, but can no longer be manipulated. I've put a debug both in the kill function and in the print function to see if the method is just no being called somewhere, but they are. It registers that the kill method is being called on every tile, but its just not doing anything. Any ideas?
UPDATE Disregard. I got it. For the purpose of anyone else who comes across this question looking for the same answer, Destroy(this) only destroys the attached script. Destroy(gameObject) destroys the entire cloned object.
public void destroyTiles()
{
int rows = tiles.Count;
for (int i = 0; i<rows; i++)
{
int tile = tiles[i].Count;
for (int j=0; j<tile; j++)
{
tiles[i][j].$$anonymous$$illTile();
}
Debug.Log("Number of tiles in this row: " + tiles[i].Count);
}
}
public class $$anonymous$$apTile : $$anonymous$$onobehavior;
public void $$anonymous$$illTile ()
{
GameObject.Destroy(this);
Debug.Log("Tile Destroyed");
}
Oh man... thank you. This stupid thing was happening to me. You save me some $$anonymous$$utes.