Hello,
I am new to unity and I am running in a problem ( evidently since I am here Haha).
I am creating a 2D and my game board is generated in same way than in the Rogue Like example. But when I stop the game the board is not destroyed and is keeped in the scene. I tried to forcefully destroy it at the end of the play with OnApplicationQuit() and DestroyImmediate(boardHolder.transform.gameObject) but it still remain in my scene.
here is my generating method:
void BoardCreate()
{
GameObject instance;
if (boardHolder != null) DestroyImmediate(boardHolder.transform.gameObject);
boardHolder = new GameObject("Board").transform;
for (int x = 0; x < 10; x++)
{
for (int y = 0; y < 7; y++)
{
switch (board[x, y])
{
case 1:
instance = Instantiate(line, new Vector3(x, y, 0f), Quaternion.identity, boardHolder) as GameObject;
break;
case 2:
instance = Instantiate(flipUpRight, new Vector3(x, y, 0f), Quaternion.identity, boardHolder) as GameObject;
break;
case 3:
instance = Instantiate(flipUpLeft , new Vector3(x, y, 0f), Quaternion.identity, boardHolder) as GameObject;
break;
case 4:
instance = Instantiate(flipVerti , new Vector3(x, y, 0f), Quaternion.identity,boardHolder ) as GameObject;
break;
default:;
break;
}
}
}
}
thank you in advance for your help.
have a nice day.
P.S. : I am french so excuse me if my english is not great;)