Hi, I have some problem with this code
public void FormTileIslandArray()
{
ClearIsland();
for( CardAtt.COLORS color = CardAtt.COLORS.RED; color< CardAtt.COLORS.LENGTH; color++ )
{
for( CardAtt.NUMBERS number = CardAtt.NUMBERS.ONE; number< CardAtt.NUMBERS.LENGTH; number++ )
{
SpawnTileIsland( number, color );
}
}
}
public void ClearIsland()
{
foreach( GameObject tileIsland in GameObject.FindGameObjectsWithTag("tileIsland") )
{
DestroyObject(tileIsland);
}
}
The code was suppose to delete away all of the existing TileIsland Gameobjects before going into a Spawn sequence.
However, all of the TileIsland didn’t get deleted before going into spawn sequence, so it caused unwanted errors.
I tried Coroutine, and it didn’t helped.
TileIsland is only meant to store list of tiles data.
The reason that I made TileIslands into GameObjects, was so that I can check their data in the inspector.
If I made Tile Island into an ArrayList instead, I don’t know how to check what’s inside.
Can anyone suggest me an alternative way to solve this? THX in advance.