(17) unity4.6 learn Ugui Chinese Document ------- tips-Creating a World Space UI, ugui-creating
Hello everyone, I am Sun Guangdong. Reprinted please indicate the source: http://write.blog.csdn.net/postedit/38922399
More comprehensive content please see my game pretty cool address: http://www.unitymanual.com/forum.php? Mod = guide & view = my
3. Creating a World Space UI
The UI system can easily create a UI user interface, which is located in the world between objects in other 2D or 3D scenarios.
Start by creating a UI element (such as an Image). If you do not have it in your scenario, you can use: GameObject> UI> Image. This will also create a canvas for you.
Set the Canvas to World Space
Select your canvas and change the Render Mode rendering Mode to World Space.
Now your canvas is already in the world space, and all cameras can be seen if they all point to it, but it may be huge compared to other objects in your scenario.
Decide on a resolution
First, you need to determine the canvas resolution. What is the pixel resolution of an image if it is an image? Like 800x600 may be a good starting point. You enter the width and height of the resolution on the Rect Transform of the canvas. It may be a good idea to set the location to 0 or 0 at the same time.
Specify the size of the Canvas in the world
Now, you should consider what the canvas should be like in the world space. You can use the Scale scale tool, but Scale down until it looks good, or you can decide how many meters it should have.
If you want it to have a specific width in the meter, you can calculate the required scale by formula: meter_size/canvas_width. For example, if you want it to be 2 m wide and the canvas width is 800, you will have 2/800 = 0.0025. You then set the Scale attribute of the Rect Transform to X, Y, and Z as the 0.0025 canvas to ensure that it scales evenly.
Another way to think about it is to control the size of a pixel on the canvas. If you scale the canvas by 0.0025, this is also the size of each pixel in the world on the canvas.
Position the Canvas
Unlike Screen Space, the WorldSpace canvas can be freely positioned and rotated in the scene. You can place any wall, floor, ceiling, or slanted surface on a canvas (or freely hanging in the air of the course ). Only the normal Translate translation and Rotate rotation tools are used in the toolbar.
Create the UI
Now you can set your UI elements and layout in the same way as the canvas of the screen space.
Zookeeper