电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

UI闪烁效果的实现

UI闪烁效果的实现_第1页
1/4
UI闪烁效果的实现_第2页
2/4
UI闪烁效果的实现_第3页
3/4
GUI 闪耀效果的实现 Posted on 2025 年 06 月 12 日 by U3d / Unity3D 脚本/插件/被围观 72 次 重点是 yield 和 StartCoroutine 的使用。01using UnityEngine;02using System.Collections;0304public class MainBoardTop : MonoBehaviour05{06 public Texture2D Logo;07 public Texture2D SysInfo;08 public Texture2D FriInfo;09 public Texture2D IcoHelp;10 public GUIStyle style;11 public GUIStyle pathStyle;12 private bool displaySysLabel = false;13 private bool displayFriLabel = false;14 IEnumerator Start()15 {16 yield return StartCoroutine(flashSysLabel());17 yield return StartCoroutine(flashFriLabel());18 }19 IEnumerator flashSysLabel()20 {21 while(true)22 {23 displaySysLabel = true;24 yield return new WaitForSeconds(0.5f);25 displaySysLabel = false;26 yield return new WaitForSeconds(0.5f);27 }28 }29 IEnumerator flashFriLabel()30 {31 while(true)32 {33 displayFriLabel = true;34 yield return new WaitForSeconds(0.5f);35 displayFriLabel = false;36 yield return new WaitForSeconds(0.5f);37 }38 }39 void OnGUI()40 {41 GUI.BeginGroup(new Rect(0, 0, 300, 100));42 GUI.Button(new Rect(3,5,37,37),Logo,style);43 GUI.Button(new Rect(45,8,150,15),"test",pathStyle);44 if(displaySysLabel == true)45 {46 GUI.Label(new Rect(45,25,16,16),SysInfo,style);47 }48 GUI.Label(new Rect(61,25,16,16),"0",style);49 if(displayFriLabel == true)50 {51 GUI.Label(new Rect(77,25,16,16),FriInfo,style);52 }53 GUI.Label(new Rect(93,25,16,16),"0",style);54 GUI.Label(new Rect(108,25,16,16),IcoHelp,style);55 GUI.EndGroup();56 }57}

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

UI闪烁效果的实现

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部