- Home /
Switching between 2D and 3D in the same Scene
Hello everyone, This is a general question but I hope someone might help me.
For the game I make, I need some 2D and 3D Elements. In the "3D world", the player is moving his character. On the other hand, when pressing a button, I want to switch to a "2D mode". This is like a map view where I want to draw the map, some icons on top of it etc.
It all works fine in separate scenes. So I have one scene with a 3D Cam, objects to render etc. In the other 2D scene I have a SpriteRenderer showing the map, the icons etc. Still both together give me trouble.
What is the best way to mix 2D Sprites and 3D Objects in one scene? The SpriteRenderer is visible in the 3D scene so I guess I need to deactivate all it's (sub)elements? And do I have to make all 3D elements inactive while rendering the 2D view? So essentially switch all elements? Sounds unlikely to deactivate the whole world just for showing the map sprites. I assume I have to give the 2D elements a separate Layer for another camera but then again, I loose the option to give my objects different layers (which I use for my 3D elements like "distructable" etc.) Or is the SpriteRender probably not the best idea?
This is what I want. Switching to map view without changing the scene:
Thanks for any advice!
Tobias
Answer by Under_Wander · Aug 13, 2017 at 04:00 AM
My best advice would to use a Canvas and UI elements, if you want it to be more like a flat object you could have it projected onto a plane as a texture or something.
Answer by aayush_kumar · Aug 13, 2017 at 04:29 AM
I think you can do that by adding an secondary camera that is orthographic.