Deletion Sequence issue

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.

I think this happens because Destroy doesn’t destroy the objects right away, it only schedules them for destruction which occurs after the update loop, see 1 for more information.

Try with DestroyImmediate and see if that results in the desired behavior.

THX Christian,
I just checked around and found that I can get the data to appear in the inspector by using
using System.Collections.Generic;
[System.Serializable]
It worked better for me this way now.
None the less, Thank you for your reply