Development of a 2D game Inside Canvas Scaler

I am new to Unity, and I realized that it is difficult to make a multi-user 2d unity game without the paid 3 plugins available in the Asset Store.

I have done some tests, and I can do multiple resolution support as follows:

1- Place everything from the user interface (buttons, etc.) inside the Canvas object in the screen space of the render mode - overlay with a reference resolution of 16: 9 and a fixed width.

2- Place the rest of the game objects in the Game Object called GameManager with the Canvas Scaler component in the Screen Render Mode field - Camera with a 16: 9 reference resolution, fixed width and main camera. After that, all game objects, such as player, platforms, etc. Inside the GameManager, you must have a RectTransform component, a CanvasRenderer component, and an image component, for example.

Can I continue to develop the game this way, or is this the wrong way to do something?

Hi

+7
aspect-ratio unity3d unity3d-2dtools
source share
2 answers

Also do not forget the GUI , Graphics . It is a common misconception that the GUI has depreciated and slowed down. No no. The GameObject helpers for the GUI were bad and depreciated, but the OnGUI hosting API works great when you just need to draw a texture or some text on the screen. They are called a legacy, but there are no plans to remove them, since all Unity UIs are anyway made from it .

I made a few games only on them, using Unity as a very redesigned multi-platform quad drawing API.

There is also GL if you want something more.

Just remember - there will be no built-in physics, particle effects, path searches or anything else - just an easy way to draw material on the screen. You will have full control over what will be drawn - and this is also good and bad, depending on what you want to do.

+5
source share

I will not recommend you use Canvas Scaler to develop a full-fledged game. The intended purpose of scaling the canvas was to create a menu, and you should use it to create the menu.

2D games created without scaling the canvas do not create many problems (mostly they do not cause any problems) at multiple resolutions.

So, your step 1 is correct, but for step 2 you do not need to attach the canvas scaling component.

Do not forget to mark your scene as 2D (not necessary), and your camera - spelling (necessary) when developing 2D games.

+2
source share

All Articles