随笔分类 - Unity3D
摘要:详细可参考此篇博文: Unity序列化之XML,JSON 合成与解析 简单例子(SiKi学院教程): 1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 5 [System.Se
阅读全文
摘要:Mask.GetComponent<RectTransform>().anchoredPosition(子物体) = hotKey_image.rectTransform.anchoredPosition(父物体); Mask.GetComponent<RectTransform>().SetSiz
阅读全文
摘要:转载官方文档,暂未深入研究 PropertyDrawer
阅读全文
摘要:Uinity版本:2017.3 最近在学Siki老师的《黑暗之光RPG》教程,由于教程内用的是NGUI实现,而笔者本人用的是UGUI,所以在这里稍微写一下自己的实现思路(大致上和NGUI一样) 一、成品 先展现实现后的效果,如下: 功能简介: 物品的添加功能暂时通过摁下X来模拟(在Update()方
阅读全文
摘要:最新背包代码: Unity3D — — UGUI之简易背包 Unity版本:2017.3 功能:用UGUI实现简单的背包物品拖放/交换功能 一、简介 在UGUI下,物品的拖放脚本实现主要依赖于UnityEngine.EventSystems下的三个接口 IBeginDragHandler, IDra
阅读全文
摘要:NGUI下给Sprite/image添加collider后能自适应大小,但是在UGUI下Collider是默认在(0,0)位置,size为0 因此写了个简单的脚本,效果如下(最后附代码) 1.如下图添加Box Collider 2D后的默认位置与大小 2.给需要的物体添加Script并运行后的效果:
阅读全文
摘要:环境:Win10 读取text内容后unity报错:Input string was not in the correct format 同时在Inspector面板中无法预览Text文本内容 随后发现只有文本中有中文才会出现这种情况 解决方法就是将Text另存为UTF-8编码格式
阅读全文
摘要:1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 5 public class FollowTarget : MonoBehaviour { 6 7 private Trans
阅读全文
摘要:1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.Playables; 5 6 public class Player : MonoBeha
阅读全文
摘要:官方文档: http://dotween.demigiant.com/index.php 一些DOTween方法的介绍 安装插件后也可以在Add Component里添加DOTween Animation / Path两个组件来可视化地编辑 1 using System.Collections; 2
阅读全文
摘要:1.通过Slider设置图片的滑动时加载的效果 2.Image Type Image分为四个类型 Simple:有个Preserve Aspect,勾选后UI会保持相对大小而不是填充整个Canves Sliced:可以保证被切割的部分不会随着放大缩小而失真,需要在图片自身的Sprite Editor
阅读全文
摘要:1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.UI; 5 6 public class MainUIControl : MonoBeha
阅读全文
摘要:1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 5 public class RotateCirle : MonoBehaviour { 6 7 public float R
阅读全文
摘要:1 //ClickMove - - 通过鼠标点击控制物体移动 2 3 using System.Collections; 4 using System.Collections.Generic; 5 using UnityEngine; 6 using UnityEngine.AI; // inclu
阅读全文
摘要:1.操作类 1)F:选择物体后聚焦 2)V:选择物体的顶点,顶点吸附 3)Ctrl:摁住后拖动物体,可以按照系统设置的步长进行移动(Edit -> Snap setting) 4)Q W E R T :选择物体的移动,旋转等,顺序对应左上角图标 5)鼠标中键:摁住:平移/移动; 滚动:放大缩小 6)
阅读全文
摘要:1. 游戏界面 2.代码 1 //FoodRotate - - 控制cube旋转 2 3 using System.Collections; 4 using System.Collections.Generic; 5 using UnityEngine; 6 7 public class FoodR
阅读全文
摘要:1)设置好相应场景 2)创建脚本挂载到相应物体上并编写 2.代码 1 //Shoot - - 控制小球生成与射击 2 3 using System.Collections; 4 using System.Collections.Generic; 5 using UnityEngine; 6 7 pu
阅读全文

浙公网安备 33010602011771号