标签:
工作现场查看:
飞行模式: 按住鼠标右键 w s a d 围绕浏览当前视图, q e 上下浏览。 交模式下无效 需透视图
移动吸附:移动状态(w) ctrl+shif 移动吸附在其它物体上移动
顶点吸附:移动状态(w)v 键 移动吸附在其它物体上移动
特定的增量移动: 移动状态(w) ctrl ,按特定的增量移动, 能够设置增量 Edit-snapSettings.
Unity脚本的使用
void Start () { ScriptB sb = GetComponent<ScriptB>(); sb.Say(); } void Update () { this.transform.Rotate(new Vector3(0,speed * Time.deltaTime,0)); rigidbody.mass = Mathf.Sin(Time.deltaTime)+1; }
void Update () { target.renderer.material.color = Color.red; } ///// public GameObject target; void Start () { target = GameObject.Find("Main Camera/sphere"); }
arget = GameObject.FindWithTag("fuck"); GameObject.FindGameObjectWithTag("fuck" GameObject.FindGameObjectsWithTag("fuck"); 多个
void OnGUI() { GUILayout.Label("当前时间:" + Time.time); GUILayout.Label("自上一帧时间:" + Time.deltaTime); GUILayout.Label("固定增量时间:" + Time.fixedTime); GUILayout.Label("固定增量时间间隔:" + Time.fixedDeltaTime); GUILayout.Label("平滑delata时间:" + Time.smoothDeltaTime); //增量时间能够在edit-projectSetting-time中设置 }
这类方法、运算符或訪问器的体受下面约束的控制:
void Start () { StartCoroutine("Example"); //用StartCoroutine进行触发 print("Hello"); print ("world"); } //全部使用yield的函数必须将返回值类型设置为IEnumerator类型 IEnumerator Example() { print(Time.time); yield return new WaitForSeconds(2); print(Time.time); }
void Start () { print(Random.seed); print(Random.value); print(Random.Range(0,1)); print(Random.Range(0.0f,1.0f)); }
public class SendMessageUpward : MonoBehaviour { void OnMouseOver() { SendMessageUpwards("someoneSay","fuck u"); } } public class RecieveMessage : MonoBehaviour { void someoneSay(string str) { print("someoneSaied" +str); } }
public class EventDispatcher : MonoBehaviour { public delegate void EventHandler(); public event EventHandler MouseOver; void OnMouseOver() { if(MouseOver != null) { MouseOver(); } } } public class EventListener : MonoBehaviour { public GameObject dispatcher; // Use this for initialization void Start () { EventDispatcher ds = dispatcher.GetComponent<EventDispatcher>(); ds.MouseOver +=Listen; } void Listen() { transform.Rotate(new Vector3(0,10*Time.deltaTime,0)); transform.renderer.material.color = Color.cyan; } }
版权声明:本文博主原创文章,博客,未经同意不得转载。
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/4852329.html