I am creating a game that shifts the player between an isometric overhead view of the map, into a perspective view. The player starts by looking at the map as such,
Isometric view of map | Scene A
Upon clicking either of the red orbs floating, the player shifts into a separate scene in the perspective view at the orb location. Shown here,
The isometric map and the perspective maps are different scenes and it is important that they remain as such. The player needs to be able to click on an orb in Scene A and then have the camera move to the set position of the orb in Scene B.
My current thought is that each orb could have a tag (1,2,...) and once clicked, this tag would be referenced with an if statement to position the camera in the other scene. My problem is that I don't know how to reference the tag of the clicked orb once I am in the next scene. Or how I would reset this back to normal if I return to Scene A.
Here is some code that I have started, but I am not sure if I am on the right path.
using UnityEngine;
using UnityEngine.SceneManagement;
public class TagCheck : MonoBehaviour
{
Camera m_MainCamera;
public string sceneName;
int count;
private void Start()
{
m_MainCamera = Camera.main;
}
void LoadScene()
{
SceneManager.LoadScene(sceneName);
DontDestroyOnLoad(gameObject);
}
void OnMouseDown()
{
LoadScene();
Debug.Log(count);
}
void OnEnable()
{
SceneManager.sceneLoaded += OnLevelFinishedLoading;
}
void OnDisable()
{
SceneManager.sceneLoaded -= OnLevelFinishedLoading;
}
void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
{
if (count == 1)
{
if (GameObject.FindWithTag("1"))
{
m_MainCamera.transform.position = new Vector3(5f, 1.5f, 5f);
}
else if (GameObject.FindWithTag("2"))
{
m_MainCamera.transform.position = new Vector3(-5f, 1.5f, -5f);
}
}
else
{
Destroy(gameObject);
}
}
Thank you all for the help! Let me know if I need to clarify anything.