How do I change the persistent flag after it has been set?
I have a player hit a trigger and spawn in some enemies. The player dies so I don't want the enemy to disappear so I have the persistent flag set to true.
However, if I have the player kill the enemies I destroy the enemy. Then I have another player connect and automatically he gets disconnected and I get:
[TNet] Trying to execute RFC #33 on TNObject #2752505 before it has been created.
I suspect the player trying to connect is getting booted because of that error.
However, before I am booted I can see the enemies in the hierarchy in the editor. So, even though they were destroyed by the initial player. They are still around. How do I clear them out?
Additionally, often when I disconnect and then attempt to log back in my player seems to want to spawn back where he initially left even though I have persistent set to false.
I spawn in my character with this:
IEnumerator SpawnPlayer() {
while (TNManager.isJoiningChannel) yield return null;
TNManager.Create(player, spawnSpot.position, spawnSpot.rotation, false);
_playerTransform = player.transform;
}
Again, thoughts on how I can l clear these out?