Hi!
Im trying to develop a plugin, I need to create a method that cleanup the entire map starting by destroy all buildings created by the players.
This is my first try:
void resetMap()
{
Puts("test");
foreach (var wall in GameObject.FindObjectsOfType<BuildingBlock>())
{
Puts(wall.ToString());
GameObject.Destroy(wall);
}
}First I placed a foundation, and next called resetMap(), the foundation apparently is not destroyed but after I placed another foundation next to the first one, the server kicked me for "RPC Error for DoInPlace".
After reconnecting, the first foundation disappeared, but apparently there is a ghost of it (?).
I mean if I walk where the foundation was I cannot walk through like the foundation is still there, and the server console is responding with "Server Exception: BasePlayer.BudgetedLifeStoryUpdate NullReferenceException"
How does it work? How can I remove that ghost foundation?