- Home /
Portal between scenes?
So i was watching this video tutorial on seamless/smooth portals which teleports the player from one area to another. (Video Link: https://www.youtube.com/watch?v=cuQao3hEKfs)
This is all done in one scene, so my question is.... Can this be done across scenes? So if the player goes through the portal in scene 1 he comes out the other side in scene 2?
Answer by ShadyProductions · Jun 06, 2018 at 08:06 PM
This can be done several ways..
You can pass the required information, like position where to spawn in scene2 etc.. By one of these methods (there might be more)..
Some examples:
File reading/writing
DontDestroyOnLoad: https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
Singleton
Answer by raffreitas98 · Jun 06, 2018 at 09:19 PM
This this work with the camera being able to view from different scenes with texture render?
Answer by agarcia115 · Jun 07, 2018 at 06:33 AM
I think you shall load a new scene, add a texture using the camera view from the other portal but you have to load the scene, because Unity dont have it already charged on memory. Or you can use as @ShadyProductions said DontDestroyOnLoad so when you enter the portal, your last scene keep charged on memory.
For example, your scene is packed on a game object, you put a script that makes that object to not being destroy on load, you arrive to the portal and what you can really see is a texture of the other scene, you check if player entered by using a trigger, and when you charge the second scene, your firs scene keeps without destroying himself and putting that game object just next to your portal, so you can go to the first scenary and to the second one in the same scene.
I don't know if you understood me, if not i will explain it as a draw!