19. Unity - 2D game development notes 02 --- pseudo perspective, 2D object collision, tile map collision, material scaling and tiling

1. Pseudo view

In 2D game development, when the character moves, there will be front and rear occlusion between objects. The front-back relationship in the 2D view is determined by the Y axis, and the smaller the y value, the closer the object is to the front. The rendering of unity should be enabled to render according to the size of the y value to ensure the correct occlusion effect. In the menu bar Editor–>project setting --> Graphic, set it according to the following figure:
insert image description here
After the setting is completed, when the game is running, the observation needs to be mutual The comparison position between the occluded objects, the comparison position can be understood as the starting position point where unity compares the hierarchical relationship between objects when rendering the page. Generally, in 2D games, the comparison position will be set at the lowest point of the object. At the bottom, change the comparison position of each material, and the modification method is as follows:
The first method:
select the material to be set, and in its property window, directly modify the Pivot parameter to bottom, as shown in the figure below
insert image description here
: Two ways:
first select the material, then click the Sprite Editor button under the red rectangle box in the above picture, open the window and drag the blue ball pointed by the red arrow in the picture below to adjust the comparison center position of the material:

Guess you like

Origin blog.csdn.net/FY_13781298928/article/details/130416978