NGUI learning of Unity plug-in (4) -- create UI2DSprite animation and nguiui2dsprite

Source: Internet
Author: User

NGUI learning of Unity plug-in (4) -- create UI2DSprite animation and nguiui2dsprite

Create a new Scene and follow NGUI learning of Unity plug-in (2) create UI Root and create a Panel under Camera of UI Root.


In the selected Panel, choose NGUI> Create> Unity 2D Sprite from the menu.


View Inspector window



Then, make Sprite in Unity:

Create a Textures folder in the Project window, drag some image materials from the outside, select the image to be converted to Sprite, and then perform the Sprite Transformation Operation in the Inspector window ,.


Select Sprite (2D/uGUI) to complete the transition. You can select multiple images.

Then, select the previously created 2D Sprite in the Hierarchy window, and select the previously created Sprite in the Inspector window.



Then we made the UI2DSprite Animation. In the Hierarchy window, select the previously created 2D Sprite and choose Component> Scripts> UI2DSprite Animation from the menu, then, edit UI2DSprite Animation in the Inspector window.


Framerate sets the frame rate

Whether to Ignore the influence of TimeScale on animation playback when setting Ignore Time Scale

Frames manually sets the sequence of animation playback. You can drag the previously created Sprite to each Element.

Click play to view the animation effect.

However, I read the source code of UI2DSpriteAnimation, which is relatively simple. By default, only loop playback is supported, and the pause and playback functions are not available (the same as UISprinte Animation ), however, these functions can be added through simple code modifications.


Difference between UISprinte Animation and UI2DSprite Animation

In addition to performance considerations, the biggest difference in my opinion is that the control of each frame of an animation is different.


UISprinte Animation uses Name Prefix to control the image of each frame, or creates all images of a single Atlas, and the playing sequence is completely sorted by the image Name, therefore, when making an animation, it is best to end the name of each image with a number to facilitate sorting.If the same image needs to be used in multiple animations, it seems that UISprinte Animation cannot be used properly. I wonder if you have any suggestions.


The advantage of UI2DSprite Animation is that you can set any picture of each Animation frame,However, it must convert each image into a Sprite and does not know whether it is inferior in performance.



Install the Unity plug-in NGUI. After importing the package, how does one obtain the NGUI menu in this menu tutorial?

Check whether the version is correct? But I have never encountered this problem.

How to Use unity ngui tween? How can we achieve the effect of shrinking an animation? Example

TweenPosition. begin (gameobject, duration, targetPosition );

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.