随笔分类 -  Unity3d

摘要:位置 1. 移动到指定位置 2. 相对移动 透明度 颜色 缓动动画 循环 回调 振动 From DoText Sequence To 阅读全文
posted @ 2019-02-22 11:13 吴筱军 阅读(1938) 评论(0) 推荐(0)
摘要:几种常见的Coroutine操作 yield return null; 等到下一帧继续执行 yield return new WaitForEndOfFrame; 这帧结束之后继续执行 yield return new waitforfixedupdates; N帧后继续执行 yield retur 阅读全文
posted @ 2017-12-10 21:03 吴筱军
摘要:Canvas画布是承载所有UI元素的区域。所有的UI元素都必须是Canvas的子对象。如果场景中没有画布,那么我们创建任何一个UI元素,都会自动创建画布,并且将新元素置于其下。 Rander Mode: Screen Space-Overlay(屏幕控件-覆盖模式):使画布拉伸以适应全屏大小,并且使 阅读全文
posted @ 2017-08-13 00:16 吴筱军
摘要:向量结构实例成员 返回单位向量(只读) 返回向量的长度(只读) 返回这个向量长度的平方(只读) 向量的结构方法 点乘积 点乘积的计算方式为:a▪b=|a|*|b|cos<a, b> 可以初略的判断下,当前物体是否朝向另外一个物体,只需计算当前物体的transform.forward向量与(posit 阅读全文
posted @ 2017-07-29 16:49 吴筱军 阅读(499) 评论(0) 推荐(0)
摘要:编辑器阶段 Reset方法:当脚本第一次添加到游戏对象或当前执行Reset命令时会调用。 场景第一次加载 该阶段其实也就是脚本第一次加载阶段。 会调用的方法:(这两个方法会在所有的Start和Update方法之前调用) Awake方法:在Start方法调用前调用,且不管是否激活状态都会被调用。 On 阅读全文
posted @ 2017-07-29 10:56 吴筱军 阅读(170) 评论(0) 推荐(0)
摘要:正常情况下,协程是在Update函数返回时执行,而协程的主要功能是延缓其执行,指定给定的YieldInstruction完成。 常用的协程有: yield:当下一帧所有的Update方法被调用之后,协程继续执行。 yield WaitForSeconds:等待指定时间后,协程继续。 yield Wa 阅读全文
posted @ 2017-07-23 20:32 吴筱军 阅读(168) 评论(0) 推荐(0)
摘要:UnityEngine.Object类 UnityEngion.object类是Unity3d游戏引擎的C#脚本语言中最基础的类,也就是在Unity3D中所有对象的基类。所有派生自UnityEngion.object的公开变量都会显示在inspector窗口中。 提供的成员有: 类成员 作用 字段 阅读全文
posted @ 2017-07-23 13:42 吴筱军 阅读(393) 评论(0) 推荐(0)
摘要:1. 引用类型总是分配在托管堆上,但值类型并非总是分配在线程栈上。 值类型一般分配在线程栈上,不受垃圾回收机制GC作用的影响。一些特殊情况下,值类型也分配在托管堆中,例如:数组中的元素,引用类型中的值类型字段,迭代器块中的值类型变量,闭包情况下匿名函数中的局部变量。 2. 引用类型 Class In 阅读全文
posted @ 2017-07-08 21:17 吴筱军 阅读(160) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class test : MonoBehaviour { //print只能在MonoBehavior的子类中使用,否则只能使用Debug.log() public int age; public string name; //每当脚本被加载时调用;“有添加... 阅读全文
posted @ 2016-07-19 22:32 吴筱军 阅读(1325) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class test1 : MonoBehaviour { public float angleSpeed; void Update () { if(Input.GetKeyDown(KeyCode.UpArrow)) { ... 阅读全文
posted @ 2016-07-19 22:21 吴筱军 阅读(219) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class test : MonoBehaviour { void Start () { Vector3 v = new Vector3(); float x = v.x; float y = v.y; float z ... 阅读全文
posted @ 2016-07-19 22:13 吴筱军 阅读(2491) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class transform : MonoBehaviour { // Use this for initialization void Start () { //获取当前脚本所挂载的游戏对象身上的Transform //控制游戏对象的位置... 阅读全文
posted @ 2016-07-19 21:58 吴筱军 阅读(290) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class destroy : MonoBehaviour { void Start () { print("start"); destroyObject(); //destroyImmediateObj(); ... 阅读全文
posted @ 2016-07-19 00:13 吴筱军 阅读(418) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class hitCheck : MonoBehaviour { //两个物体能发生碰撞的条件是:两个都带有collider且其中一个是刚体。 // Use this for initialization void Start () { } ... 阅读全文
posted @ 2016-07-19 00:12 吴筱军 阅读(390) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class mouse : MonoBehaviour { //private Vector3 lasePos; private Vector3 offSet; private Vector3 ScreenSpace; //1. void OnMous... 阅读全文
posted @ 2016-07-19 00:11 吴筱军 阅读(7044) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class rigidbody_ : MonoBehaviour { private Rigidbody r; void Start () { //Rigidbody rb = GetComponent(); //float mass = rb... 阅读全文
posted @ 2016-07-19 00:07 吴筱军 阅读(286) 评论(0) 推荐(0)
摘要:using UnityEngine; using System.Collections; public class test : MonoBehaviour { //在场景中鼠标点击地面后,角色可以移动到目标位置 private Vector3 target; private bool isOver = true; public float speed; ... 阅读全文
posted @ 2016-07-18 23:59 吴筱军 阅读(18990) 评论(1) 推荐(0)