Unity3D核心类型一览
来源:互联网 发布:mac合并单元格快捷键 编辑:程序博客网 时间:2024/05/17 23:02
本文记录了Unity3D的最基本的核心类型。包括Object、GameObject、Component、Transform、Behaviour、Renderer、Collider、Rigidbody、Camera、Light、MonoBehaviour等。
需要展开了public类型方法的类图请点这里(http://www.cnblogs.com/bitzhuwei/gallery/image/152116.html)。
最核心的类型就这几个:Object、GameObject、Component、Behaviour、MonoBehaviour。
需要展开了这几个public类型方法的类图请点这里(http://www.cnblogs.com/bitzhuwei/gallery/image/152118.html)。
UnityEngine.Object
所有Unity3D的基类。
持有实例的ID信息。
实现了静态方法:增(Instantiate)删(Destroy)查(FindObjectsOfType)
Any public variable you make that derives from Object gets shown in the inspector as a drop target, allowing you to set the value from the GUI.
UnityEngine.GameObject
/// <summary>
/// game object contains components.
/// <para>Add Component</para>
/// <para>Find Component</para>
/// <para>common components</para>
/// <para>BroadcastMessage在这个游戏物体及其子物体的所有MonoBehaviour中调用名称为methodName的方法.</para>
/// </summary>
GameObject.active is obsolete. Use GameObject.SetActive() , GameObject.activeSelf(read only) or GameObject.activeInHierarchy(read only) .
gameObject.SetActiveRecursively() is obsolete. Use GameObject.SetActive(), which is now inherited by children.
UnityEngine.Component
所有的Component,都会指向其所属的GameObject。
在脚本中用 this.renderer , this.transform , this.GetComponent(XXX) , this.gameObject 与 this.gameObject.renderer , this.gameObject.transform , this.gameObject.GetComponent(XXX) , this.gameObject.gameObject 的结果是完全一样的。这意味着,你用 this.renderer.transform.renderer.collider 这种写法,仍然可以得到 this.collider 。(在这些组件不是 null 的前提下)
the active property is deprecated on components. Please use gameObject.active instead. If you meant to enable / disable a single component use enabled instead.
GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf(read only) or GameObject.activeInHierarchy(read only) .
1 //this.gameObject.active = false;//GameObject.active is obselete 2 this.gameObject.SetActive(false);// ! use this to write 3 this.gameObject.activeSelf = false;//readonly 4 this.gameObject.activeInHierarchy = false;//readonly 5 6 //this.active = false;//Component.active is obsolete 7 this.transform.active = false;//cannot disable singly 8 this.particleSystem.active = false;//cannot disable singly 9 this.rigidbody.active = false;//cannot disable singly10 11 this.GetComponent<TestEqual>().enabled = false;//work on single behaviour12 this.renderer.enabled = false;//work on single renderer13 this.collider.enabled = false;//work on single collider
UnityEngine.Texture
UnityEngine.Mesh
UnityEngine.Material
UnityEngine.Transform
UnityEngine.Renderer
UnityEngine.ParticalSystem
UnityEngine.Behaviour
UnityEngine.Collider
UnityEngine.Rigidbody
UnityEngine.AudioListener
UnityEngine.Camera
UnityEngine.Animator
UnityEngine.AudioSource
UnityEngine.Light
UnityEngine.Animation
UnityEngine.MonoBehaviour
1 namespace UnityEngine 2 { 3 using System; 4 using System.Collections; 5 using System.Runtime.CompilerServices; 6 using UnityEngine.Internal; 7 8 public class MonoBehaviour : Behaviour 9 {10 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]11 public extern MonoBehaviour();12 public void CancelInvoke()13 {14 this.Internal_CancelInvokeAll();15 }16 17 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]18 public extern void CancelInvoke(string methodName);19 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]20 private extern void Internal_CancelInvokeAll();21 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]22 private extern bool Internal_IsInvokingAll();23 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]24 public extern void Invoke(string methodName, float time);25 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]26 public extern void InvokeRepeating(string methodName, float time, float repeatRate);27 public bool IsInvoking()28 {29 return this.Internal_IsInvokingAll();30 }31 32 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]33 public extern bool IsInvoking(string methodName);34 public static void print(object message)35 {36 Debug.Log(message);37 }38 39 public Coroutine StartCoroutine(IEnumerator routine)40 {41 return this.StartCoroutine_Auto(routine);42 }43 44 [ExcludeFromDocs]45 public Coroutine StartCoroutine(string methodName)46 {47 object obj2 = null;48 return this.StartCoroutine(methodName, obj2);49 }50 51 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]52 public extern Coroutine StartCoroutine(string methodName, [DefaultValue("null")] object value);53 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]54 public extern Coroutine StartCoroutine_Auto(IEnumerator routine);55 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]56 public extern void StopAllCoroutines();57 public void StopCoroutine(IEnumerator routine)58 {59 this.StopCoroutineViaEnumerator_Auto(routine);60 }61 62 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]63 public extern void StopCoroutine(string methodName);64 public void StopCoroutine(Coroutine routine)65 {66 this.StopCoroutine_Auto(routine);67 }68 69 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]70 internal extern void StopCoroutine_Auto(Coroutine routine);71 [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]72 internal extern void StopCoroutineViaEnumerator_Auto(IEnumerator routine);73 74 public bool useGUILayout { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }75 }76 }
总结
- Unity3D核心类型一览
- Unity3D核心类型一览
- Unity3D核心类型一览
- Unity3D核心类型一览
- Unity3D核心类型
- Unity3D核心类型(二)
- Unity3D GUI效果一览
- Unity3D GUI 效果一览
- Unity3D GUI 控件一览
- [Unity3D]GUI 效果一览
- JavaScript核心语法一览
- 数据中心核心网络技术一览
- SAT数学核心词汇一览
- JavaScript ES6 核心功能一览
- JavaScript ES6 核心功能一览
- MySQL索引类型一览
- MySQL索引类型一览
- MySQL索引类型一览
- 链式前向星
- HDU 2037今年暑假不AC
- 默默地开始
- 1.找到一个字符串各次出现的位置
- netbeans创建JAVA类基础使用
- Unity3D核心类型一览
- nyoj.484 The Famous Clock【水题】 2015/03/15
- 23. Merge k Sorted Lists
- C++多线程编程信号量-五
- PHP连接Mysql的两种方式:OPP&OOP
- 集合
- iptables详解
- UDP校验
- SD卡读写之FileNotFoundException: /storage/emulated/0object.txt: open failed: ENOENT (No such file or dir