当前位置:网站首页>On scale of canvas recttransform in ugui

On scale of canvas recttransform in ugui

2022-06-11 20:11:00 iningwei

Preface

Canvas Of Rect Transform Component's Scale Values and Canvas Component's Render Mode Setup related .

When it comes to Screen Space - Overlay when Scale The value is 1, Non modifiable .

When it comes to World Space When ,Scale The value is defaults to 1, But it can be modified .

The following is a specific summary Render Mode by Screen Space - Camera when ,Scale How values are calculated .

Screen Spcae - Camera Mode of Scale value

In this mode Scale The value is automatically calculated by the engine , And can't modify .

This pattern relies on a Camera, Usually in UI In the system, we will use the orthogonal camera . In the following, we will discuss... In the orthogonal camera mode in detail Scale value , We'll deduce when we have time behind the perspective camera .

Suppose the height of the current screen is ScreenH, The orthographic camera has a parameter that the user can set Size, So the formula is as follows :

ScreenH*Scale*(1/2)=Size

You can get :Scale=(2*Size)/ScreenH

contrast Sprite Renderer

Doing pure 2D In the game , More use Sprite Renderer Components , Orthographic cameras are also commonly used , Camera's Size Set the rule to :Size= Design resolution height /100/2

Suggest

Use UGUI When developing ,UI Camera's Size Don't set it up at will . Usage rule :Size= Design resolution height /100/2

原网站

版权声明
本文为[iningwei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206112008460093.html