Details of ngui Research and Development Projects

Source: Internet
Author: User

Zookeeper

I have been using the NGI plug-in for some time. I feel that ngui is really the most useful UI plug-in unity3d. However, it also has bugs that are not bugs. These problems may make new users confused. This article will summarize some development experiences using ngui during this period, there are also several questions from my friends. I will list these questions. In the previous chapter, we learned about ngui research and made a self-made scroll view.You can check it out.

1. Restrictions on Images

For iPhone or android on mobile platforms, keep your image size smaller than or equal to 1024x1024. Otherwise, the loaded image cannot be displayed, the image is painted with black paint. the maximum size of the image on the PC platform is 4096x4096.

Note! This is not complete yet, as shown in. Make sure that the size of your image is the same as the width or height of the image on any platform. For example, 32x32, 32x64, 128x32, 1024x519, 1024x1024, and 512x32 are equal to the displayed size value.

For example, if art shows you a 960x640 image, you directly put it in the program, and ngui will automatically stretch the image. So you need the art to put this 960x640 image in a 1024x1024 image, so that the image will not stretch, as shown in, just like this, the size of this image is 1024x1024, but in the program, only 960x640 is cut through the genie, so this image will not be stretched in the iPhone or android.

Next is the material, and there are also some requirements for the selection of the material coloring device. as shown in, please select your material shader as unformatted/transparent colored. If you choose not to use it, your UI will not be able to display transparent background images.

2. Genie presets or font presets

Create a new UI with ngui in the navigation bar, and create the sprite presets and font presets in the project view. When you create a new part in the panel, as shown in, click atlas or font. If the preset cannot be found. Don't be nervous. You just need to drag the genie or font presets in the project view to the hierarchy view, and click Create new part again, click atlas or font to display the genie or font preset you need. After the selection is complete, delete the default value in the hierarchy view. This method is used once for any new genie presets or font presets.

(In addition, if you click "Point in the project view" in the reference comments, thank you for your reply ~~)

3. Create Your UI in the 3D world.

For example, in the 3D game interface, you can select some UIS such as skills, items, and character states. These UIS will not change their positions because the main character moves and will always appear at the beginning of the interface. As shown in, place the original camera in your game world under the UI root (2D) and make all the UIS a subclass of this camera, this is to solve the problem that the camera can still maintain the original distance between the UI and the camera after it moves. For other 3D Game objects, please maintain the same level as the UI root (2d. To display 3D objects, set your camera projection to perspective.

4. display area of the scroll View list

How to modify the display area of the scroll View list. I remember several of my friends asked me this question. I think this is a bug in ngui. However, we can use another method to solve this problem, so let's talk about my development experience.

As shown in, you can modify the overall display area of the scrollview, but note that the display area of the scrollview is tightly modified ,, because the position of the item previously set in the scrollview is not modified because of the modification of the display area of the scrollview. We recommend that you modify the width and height of the scrolleview. However, do not change the x-y axis.

If you want to modify the x-y axis of scroll view, as shown in, select the parent panel object displayed in scrollview in hierarchy view, then, you can change the XYZ coordinates of the object in the scene view, so that the items corresponding to all the scrollview below will be modified. Then the display area of the ngui scrollview is perfectly modified.

Finally, there is no code in this article, but I hope it can help some friends who just got started with ngui.

Details of ngui Research and Development Projects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.