随笔分类 -  UGUI

摘要:using UnityEngine; using System.Collections; public class MoveTarget : MonoBehaviour { public GameObject _target1;//左侧目标位置 public GameObject _target2;//右侧目标位置 bool _check = true; boo... 阅读全文
posted @ 2017-07-17 16:35 CocomoNo1 阅读(1038) 评论(0) 推荐(0)
摘要://方法一: Image/pic 在 Assets/Resources/目录下 Image _myImage; void Start() { _myImage.sprite = Resources.Load("Image/pic", typeof(Sprite)) as Sprite; } //方法二:mySprite 为外部指定的图片资源 Image _myImage; Spr... 阅读全文
posted @ 2017-02-28 10:14 CocomoNo1 阅读(1996) 评论(0) 推荐(0)
摘要:public IEnumerator IData() { yield return null; while (true) { TemperatureData(45f, 50f); yield return new WaitForSeconds(2f)... 阅读全文
posted @ 2016-12-08 13:29 CocomoNo1 阅读(190) 评论(0) 推荐(0)
摘要:公共变量的脚本 Toogle和Button控制同一窗口的显隐 阅读全文
posted @ 2016-08-27 14:44 CocomoNo1 阅读(334) 评论(0) 推荐(0)
摘要:public GameObject ToggleControl;//控制窗体显隐的开关 private bool Flag; //用于获取Toggle的开关状态 Public GameObject InforWin;//信息窗口 void Start() { InforWin.SetActive(f 阅读全文
posted @ 2016-08-24 17:30 CocomoNo1 阅读(251) 评论(0) 推荐(0)
摘要:using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [RequireComponent(typeof(Image))] public class DragMe : MonoBehaviour, IBeginDragHandler, IDragHandler,IEndDragHandler { ... 阅读全文
posted @ 2016-08-09 15:20 CocomoNo1 阅读(305) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Collections.Generic; public class TwinkleImg : MonoBehaviour { private Image img; private float alpha = 1f;//初... 阅读全文
posted @ 2016-08-08 16:10 CocomoNo1 阅读(623) 评论(0) 推荐(0)
摘要://参考物体 CubeZ的坐标 //脚本挂载位置 运行结果: 图片随鼠标绕轴心旋转 阅读全文
posted @ 2016-08-08 10:12 CocomoNo1 阅读(213) 评论(0) 推荐(0)
摘要://方法一:利用泛型集合 获取Button名字 实现持续打印 using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.EventSystems; using System.Collections.Generic; public class PrintInfo : MonoBeha... 阅读全文
posted @ 2016-07-27 14:52 CocomoNo1 阅读(454) 评论(0) 推荐(0)
摘要://脚本挂在需要跟随鼠标移动的UI上 using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.EventSystems; public class CharacterControl : MonoBehaviour { public Camera UICamera; Vec... 阅读全文
posted @ 2016-07-20 16:28 CocomoNo1 阅读(541) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.EventSystems; public class MoveDirections : MonoBehaviour { //控制四个方向的按钮 public GameObject MoveUp; public Ga... 阅读全文
posted @ 2016-07-20 15:25 CocomoNo1 阅读(408) 评论(0) 推荐(0)
摘要:Project 说明:Content(GameObject)为text的父物体,text用于显示文本内容。ScrollBar为滚动条。 实现效果: Hierarchy: Inspector: 步骤: 1:GameObject新命名为Content,添加Text用于显示文本内容,ScrollBar的设 阅读全文
posted @ 2016-07-06 16:49 CocomoNo1 阅读(4960) 评论(0) 推荐(0)
摘要:ReviewImg用于显示图片,所挂脚本为ImageName using UnityEngine;using System.Collections; public class ImageName : MonoBehaviour { public string _imageName; } GroupB 阅读全文
posted @ 2016-07-06 10:21 CocomoNo1 阅读(960) 评论(0) 推荐(0)
摘要://使用List需添加的命名空间using System.Collections.Generic; //声明元素类型为int类型的List容器 //ToolPic用于盛放图片 public List<GameObject> ToolPic2 = new List<GameObject>(); //T 阅读全文
posted @ 2016-07-02 11:57 CocomoNo1 阅读(319) 评论(0) 推荐(0)
摘要:一:(碰撞体)触发信息检测: 发生碰撞的两个物体应满足的条件: NO1:两物体都应该有碰撞体 NO2:其中一个带刚体; NO3:检测触发信息的脚本需绑定在带刚体的物体上 1.MonoBehaviour.OnCollisionEnter( Collision collisionInfo ) 当进入碰撞 阅读全文
posted @ 2016-07-01 09:52 CocomoNo1 阅读(532) 评论(0) 推荐(0)
摘要:using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [RequireComponent(typeof(Image))] public class DragMe : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {... 阅读全文
posted @ 2016-07-01 09:27 CocomoNo1 阅读(690) 评论(0) 推荐(1)