Communicate between scenes with prefabs?

So I want to make a game logic like, I have a Main_Level, from that you can go to 4 sublevels.If you change something in the sublevel, when coming back to the Main_Level, there will be a change due to the change of sublevel. For example: From the Main_Level you going to the Level_01, triggering an object there, and you coming back after that to the Main_Level, and due to that triggering there will appear an object, that wasn’t there before.

So I’ve tried to do the following:
Created a Prefab in the Main_Level, and created a script for the trigger in the Level_01, which activating this Prefab. When you coming back to the Main_Level it will appear. And thats working in the editor, but in the build doesn’t. Any ideas to make it work?

Thanks!
Máté

Are you modifyng the prefab asset directly? You can’t do that in a build, the assets are locked. I thought it didn’t work in the editor either.

Anyway, that’s not a good approach, you should save the information in a file and use that information when you need to. For example, use a text file, in the sub_level and add a line to that file with some ID when you want to acivate that object in the main level, then in the main_level always check that file, and activate the object if the ID is in there.

Use void Awake() { DontDestroyOnLoad(transform.gameObject); }

Cool, i found a solution in that question:

Just made an empty GameObject in Main_Level, added a script with static variables, then created an other script. In the other script I can change the static variable in the first script. And it can communicate between the scenes!