New item after Loadlevel

Hi, sorry for my English… :sunglasses:

I am looking for how to add a new item after loading a level (the main one) if we win the previous level… It’s a kind of mini-games and we have to collect different items in several levels.
Thanks for your help!

Loïc

You need a persistant object. So either the item that you loaded in on the first level needs to have the DontDestroyOnLoad(object) called or you need to have a GameController which will tell what objects should be in the game and creates them if needed… (that GameController must then have the DontDestroyOnLoad(GameController.gameObject) called for it.

alternatively but not as elegant as DontDestroyOnLoad you can also have a static class (not inherited from mono behavior) to keep track of the players achievements. this also dont need to be attached to a game object. look for singleton design pattern for a oop conform implementation.

and remember that if you load a scene where a DontDestroyOnLoad-Object is initialized multiple times the object will also be created multiple times. so either you check if its exists already and only do DontDestroyOnLoad if not. or you have a certain scene only for creating this object(s) which is definitely loaded only once during game. i usually call it InitScene and make it load as the first when game starts. when objects are created the next scene is loaded immediately. disadvantage is that if you start your game in unity (play button) you need to be the initscene the active one if other scenes rely on the data there. so after tweaking the scene your are working on you need to switsch to initscene again.