I am making a game which involves creating many similar levels. To cut out much of the initial busy work of setting up each level, I created a prefab called “Level”.
The level prefab is simply a container object that holds:
- The main camera with custom settings
- An instance of the player prefab
- An instance of the exit prefab
- A blank instance of a custom TileMap prefab
- An empty “Enemies” game object for storing enemies made during the course of level creation
This setup causes behaviours which I do not understand. For example, I have an enemy prefab called “Poacher”. I drag three instances of the Poacher under the “Enemies” container and position them in the level. Later on I decide to make a change to the “Poacher” prefab. Two things happen which I do not understand:
- The change is not propagated to the instances of the poacher I have already placed in the level.
- In order to try and force these changes through, I click on one of the Poachers in the inspector and click “Revert”. This causes the entire level to revert back to its original state, including deleting all the enemies, completely clearing the Tilemap and so on.
Is there something in the way I have set up my level prefab, or a misunderstanding of mine about the way in which prefabs work which is causing this to happen?