8
votes

I'm new in Unity and i've realized that it's difficult do a multi resolution 2d game on unity without paid 3rd plugins available on Asset Store.

I've made some tests and i'm able to do multi resolution support in this way:

1- Put everything from UI (buttons etc) inside a Canvas object in Render Mode Screen Space - Overlay with 16:9 reference resolution and fixed width.

2- Put the rest of the game objects inside a Game Object called GameManager with the Canvas Scaler component in Render Mode Screen Space - Camera with 16:9 reference resolution, fixed width and the Main Camera attached. After that, all game objects like player, platforms etc inside GameManager need to have a RectTransform component, CanvasRenderer component and Image Component for example.

Can i continue developing the game in that way, or this is a wrong way to do the things?

Regards

2
The Canvas is for GUI components and not made for creating a full game. However changing the resolution of the game should be fine, I'm sure you can set the viewport to stay at 800 by 600, I may have some coding laying around, but I will have to check later for youCanvas
Thank u for your help. I'm waiting for your code to change the resolution of the game.mistic
It seems the code I have laying around would help you here :( the code I have is basically keep the game resolution the same no matter what, even if they go fullscreen. however I did find this gamedev.stackexchange.com/questions/79546/…Canvas
Thanks, i will try this :)mistic

2 Answers

5
votes

Also don't forget GUI, Graphics. It's a common misconception that GUI it's depreciated and slow. No it's not. The GameObject helpers for GUI were bad and are depreciated, but the API for putting in OnGUI works great when all you need is to draw a texture or some text on a screen. They're called legacy, but there are no plans as to remove them, as the whole Unity UI is made out of it anyway.

I have made a few games just on these, using Unity as a very overengineered multiplatform API for draw quad.

There is also GL if you want something more.

Just remember - there will be no built-in physics, particle effects, path finding or anything - just a simple way to draw stuff on the screen. You will have total control over what will be drawn - and this is both a good and bad thing, depending on what you want to do.

2
votes

I will not recommend you using Canvas Scaler for developing a complete game. Intended purpose of the canvas scaler was to create menus and you should use it to create menus only.

The 2D games created without the canvas scaler don't create much problems (mostly they don't cause any problems) on multiple resolutions.

So, your step 1 is correct but for step 2 you don't need to have a canvas scaler component attached.

Do remember to mark your scene as 2D (not necessary) and your camera to orthographic (necessary) while developing 2D games.