Skip to main content
GameDev.net gamedev.net
🔒 Locked

Infos between scenes - Unity

Started by Devincenzi Feb 12, 2020 at 4:59 AM 1 replies 4k views
Original Post
Devincenzi
Devincenzi

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

Shaarigan
Shaarigan

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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.