Infos between scenes - Unity

Started by
1 comment, last by Shaarigan 4 years, 3 months ago

Hey everyone, i'm trying to make my own first game and need a little help. I have two principal scenes, one where the players can moves freely, in this scene i separated the scenario by rooms 15x15, each room has her own tilemap. When the player collides with an enemy, he should go to a different scene, where will be loaded an tiled arena, so the battle will be turn based at that scene.
What i need is get the tiles from the room where the player and enemy was, their positions and names/id to load on the new scene.

Sorry for bad english and thanks for attemption! :3

Advertisement

You have several options,

  1. store those information in a static cache (static code is never unloaded)
  2. have a master scene that loads all the other scenes additively and keeps track of the values in it's game objects
  3. use the singleton pattern to have a manager object and set this object to DontDestroyOnLoad = true to keep it alive all the time even if scenes change.

The most preferrable one would be #2 because you don't need to copy player and mosnter instances rather than simply change the environment and gameplay rules

This topic is closed to new replies.

Advertisement