Ngui learning for unity plug-ins (2) -- create texture and Sprite

Source: Internet
Author: User

首先删除当前的MainCamera并保存当前的scene

选择菜单NGUI->Create->2D UI


添加后显示


Directional light是过后添加的直射光线

在Hierarchy窗口选择Camera,在Inspector窗口中,UICamera的Event Type选择2D UI。

然后在Build Settings...切换Android平台,下一步很重要,在UI Root选择Scaling Style为FixedSizeOnMoblies,一开始是默认的PixelPerfect,造成我的预览窗口和运行窗口的大小尺寸不一样。

在Hierarchy窗口的Camera下,创建NGUI->Create->Anchor(锚点),注意:该锚点的坐标x轴并不是0,而且始终无法修改,让我很困惑,希望有知道的朋友能提点。

然后在Anchor下,创建NGUI->Create->Plane。

接着就是创建的准备工作了:材质的制作

在Project窗口下面创建一个Textures文件夹,将一些图片拖到该文件夹中,然后就是Altases的制作了,可以参考宣雨松的文章http://www.xuanyusong.com/archives/891和http://www.xuanyusong.com/archives/942,很推荐宣雨松的文章,大家可以收藏他的首页。


材质制作完成后,在Hierarchy窗口的Plane下,创建NGUI->Create->Texture


在Inspector窗口中,在Texture选择需要的贴图,大小储存可以在Widget中的size中调整,Depth表示GameObject绘制的顺序,从最小的数字开始绘制。


在Hierarchy窗口的Plane下,创建NGUI->Create->Sprite


在Inspector窗口中,在Altas选择自己制作的UIAltas,并选择需要的精灵图片。

Type类型中Fill可以制作转圈的技能CD特效,请参考宣雨松的http://www.xuanyusong.com/archives/2399

在Hierarchy窗口的Sprite下面,添加Component->NGUI->UI->Sprite Animation,也可以在Inspector窗口中,点击Add component添加Sprite Animation。


Framerate表示帧率

Name Prefix表示需要播放动画的图片名字的前索引,我的图片是从num_collide_0到num_collide_5

Loop表示是否循环

点击运行就能看到动画效果了。

Unity插件之NGUI学习(2)—— 创建Texture和Sprite

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.