Home Game Development Screen splitted in several areas, every with a distinct scene in Unity

Screen splitted in several areas, every with a distinct scene in Unity

0
Screen splitted in several areas, every with a distinct scene in Unity

[ad_1]

This is simple to attain with viewports.

Inside the Inspector settings on the Camera part, you will discover a part labelled “Viewport Rect” that defines the rectangle on display that this digital camera ought to render to.

The default worth is {x: 0, y: 0, w: 1, h: 1} which suggests “begin within the bottom-left nook (0, 0) and occupy 100% of the width and peak”. Changing these 1s to 0.25 would make the digital camera render to only one quarter of the display, and hanging the 0s would transfer the place that quarter-screen pane sits inside the wider display (or window).

So: give every “scene” you wish to render its personal digital camera, with completely different viewport rectangles every. That will get your break up display rendering taken care of.

You can writer every of those 4 panes in a separate scene file should you like, and once you begin the sport, load all 4 scenes collectively utilizing LoadSceneMode.Additive to stack the scenes up within the present state, somewhat than unloading the earlier scene earlier than loading the subsequent.

This overlaps all scenes in a single world coordinate house, so you will wish to writer them so they do not intrude with one another. I’d advocate putting them in distinct areas of the world coordinate system (not too removed from the origin), in order that once you view them within the scene view whereas testing you may see and choose content material from every one with out confusion. You can even use Layers to filter content material, so cameras in a single scene do not see content material loaded from one other, and so physics objects in a single do not intrude with one other.

You can talk between these scenes with a static supervisor script. Or you may writer a few of them that must be tightly linked (just like the 3D scene and its 2D map) in a single scene file to make it straightforward to wire up references between them (although you may nonetheless save every model of the scene as its personal prefab should you additionally like working with them as separate information at different instances).

You may even make this with a single copy of the 3D house rendered from two views by two cameras, utilizing layer and shader methods to make the 2D map digital camera render it the best way you need with no need to writer a complete second copy of the house. This can prevent from bugs that come up once you change one thing in a single model of the scene and neglect to make precisely the identical change in its counterpart.

Or, one other manner you may assault this, since all of your different “scenes” are 2D, is to make use of the UI system. You can render your 3D scene to 1 nook with a viewport as defined above, then put your different 4 views right into a UI Canvas set to Screenspace Overlay mode, so it attracts over the entire display in spite of everything cameras have rendered.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here