unity核心类图学习总结

在这里插入图片描述

1 componet

在这里插入图片描述
https://docs.unity3d.com/2017.4/Documentation/ScriptReference/30_search.html?q=compon

 public Component();

        //
        // 摘要:
        //     The game object this component is attached to. A component is always attached
        //     to a game object.
        public GameObject gameObject { get; }
        //
        // 摘要:
        //     The tag of this game object.
        public string tag { get; set; }
        //
        // 摘要:
        //     The Rigidbody attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead. (UnityUpgradable)", true)]
        public Component rigidbody { get; }
        //
        // 摘要:
        //     The Rigidbody2D that is attached to the Component's GameObject.
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property rigidbody2D has been deprecated. Use GetComponent<Rigidbody2D>() instead. (UnityUpgradable)", true)]
        public Component rigidbody2D { get; }
        //
        // 摘要:
        //     The Camera attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property camera has been deprecated. Use GetComponent<Camera>() instead. (UnityUpgradable)", true)]
        public Component camera { get; }
        //
        // 摘要:
        //     The Light attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property light has been deprecated. Use GetComponent<Light>() instead. (UnityUpgradable)", true)]
        public Component light { get; }
        //
        // 摘要:
        //     The Animation attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property animation has been deprecated. Use GetComponent<Animation>() instead. (UnityUpgradable)", true)]
        public Component animation { get; }
        //
        // 摘要:
        //     The Transform attached to this GameObject.
        public Transform transform { get; }
        //
        // 摘要:
        //     The ConstantForce attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property constantForce has been deprecated. Use GetComponent<ConstantForce>() instead. (UnityUpgradable)", true)]
        public Component constantForce { get; }
        //
        // 摘要:
        //     The AudioSource attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property audio has been deprecated. Use GetComponent<AudioSource>() instead. (UnityUpgradable)", true)]
        public Component audio { get; }
        //
        // 摘要:
        //     The GUIText attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property guiText has been deprecated. Use GetComponent<GUIText>() instead. (UnityUpgradable)", true)]
        public Component guiText { get; }
        //
        // 摘要:
        //     The NetworkView attached to this GameObject (Read Only). (null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property networkView has been deprecated. Use GetComponent<NetworkView>() instead. (UnityUpgradable)", true)]
        public Component networkView { get; }
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property guiElement has been deprecated. Use GetComponent<GUIElement>() instead. (UnityUpgradable)", true)]
        public Component guiElement { get; }
        //
        // 摘要:
        //     The GUITexture attached to this GameObject (Read Only). (null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property guiTexture has been deprecated. Use GetComponent<GUITexture>() instead. (UnityUpgradable)", true)]
        public Component guiTexture { get; }
        //
        // 摘要:
        //     The Collider attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property collider has been deprecated. Use GetComponent<Collider>() instead. (UnityUpgradable)", true)]
        public Component collider { get; }
        //
        // 摘要:
        //     The Collider2D component attached to the object.
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property collider2D has been deprecated. Use GetComponent<Collider2D>() instead. (UnityUpgradable)", true)]
        public Component collider2D { get; }
        //
        // 摘要:
        //     The Renderer attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property renderer has been deprecated. Use GetComponent<Renderer>() instead. (UnityUpgradable)", true)]
        public Component renderer { get; }
        //
        // 摘要:
        //     The HingeJoint attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property hingeJoint has been deprecated. Use GetComponent<HingeJoint>() instead. (UnityUpgradable)", true)]
        public Component hingeJoint { get; }
        //
        // 摘要:
        //     The ParticleSystem attached to this GameObject. (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property particleSystem has been deprecated. Use GetComponent<ParticleSystem>() instead. (UnityUpgradable)", true)]
        public Component particleSystem { get; }

        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   parameter:
        //     Optional parameter to pass to the method (can be any value).
        //
        //   options:
        //     Should an error be raised if the method does not exist for a given target object?
        [ExcludeFromDocs]
        public void BroadcastMessage(string methodName);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   parameter:
        //     Optional parameter to pass to the method (can be any value).
        //
        //   options:
        //     Should an error be raised if the method does not exist for a given target object?
        [ExcludeFromDocs]
        public void BroadcastMessage(string methodName, object parameter);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   parameter:
        //     Optional parameter to pass to the method (can be any value).
        //
        //   options:
        //     Should an error be raised if the method does not exist for a given target object?
        [FreeFunction("BroadcastMessage", HasExplicitThis = true)]
        public void BroadcastMessage(string methodName, [Internal.DefaultValue("null")] object parameter, [Internal.DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   parameter:
        //     Optional parameter to pass to the method (can be any value).
        //
        //   options:
        //     Should an error be raised if the method does not exist for a given target object?
        public void BroadcastMessage(string methodName, SendMessageOptions options);
        //
        // 摘要:
        //     Is this game object tagged with tag ?
        //
        // 参数:
        //   tag:
        //     The tag to compare.
        public bool CompareTag(string tag);
        //
        // 摘要:
        //     Returns the component of Type type if the game object has one attached, null
        //     if it doesn't.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponent(Type type);
        [SecuritySafeCritical]
        public T GetComponent<T>();
        //
        // 摘要:
        //     Returns the component with name type if the game object has one attached, null
        //     if it doesn't.
        //
        // 参数:
        //   type:
        [FreeFunction(HasExplicitThis = true)]
        public Component GetComponent(string type);
        [ExcludeFromDocs]
        public T GetComponentInChildren<T>();
        public T GetComponentInChildren<T>([Internal.DefaultValue("false")] bool includeInactive);
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInChildren(Type t, bool includeInactive);
        //
        // 摘要:
        //     Returns the component of Type type in the GameObject or any of its children using
        //     depth first search.
        //
        // 参数:
        //   t:
        //     The type of Component to retrieve.
        //
        // 返回结果:
        //     A component of the matching type, if found.
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInChildren(Type t);
        //
        // 摘要:
        //     Returns the component of Type type in the GameObject or any of its parents.
        //
        // 参数:
        //   t:
        //     The type of Component to retrieve.
        //
        // 返回结果:
        //     A component of the matching type, if found.
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInParent(Type t);
        public T GetComponentInParent<T>();
        public T[] GetComponents<T>();
        public void GetComponents<T>(List<T> results);
        public void GetComponents(Type type, List<Component> results);
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        public Component[] GetComponents(Type type);
        public void GetComponentsInChildren<T>(List<T> results);
        public void GetComponentsInChildren<T>(bool includeInactive, List<T> result);
        [ExcludeFromDocs]
        public Component[] GetComponentsInChildren(Type t);
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject or any of its children.
        //
        // 参数:
        //   t:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //     Should Components on inactive GameObjects be included in the found set? includeInactive
        //     decides which children of the GameObject will be searched. The GameObject that
        //     you call GetComponentsInChildren on is always searched regardless.
        public Component[] GetComponentsInChildren(Type t, bool includeInactive);
        public T[] GetComponentsInChildren<T>();
        public T[] GetComponentsInChildren<T>(bool includeInactive);
        public T[] GetComponentsInParent<T>();
        [ExcludeFromDocs]
        public Component[] GetComponentsInParent(Type t);
        public void GetComponentsInParent<T>(bool includeInactive, List<T> results);
        public T[] GetComponentsInParent<T>(bool includeInactive);
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject or any of its parents.
        //
        // 参数:
        //   t:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //     Should inactive Components be included in the found set?
        public Component[] GetComponentsInParent(Type t, [Internal.DefaultValue("false")] bool includeInactive);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   value:
        //     Optional parameter for the method.
        //
        //   options:
        //     Should an error be raised if the target object doesn't implement the method for
        //     the message?
        public void SendMessage(string methodName, SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   value:
        //     Optional parameter for the method.
        //
        //   options:
        //     Should an error be raised if the target object doesn't implement the method for
        //     the message?
        [FreeFunction("SendMessage", HasExplicitThis = true)]
        public void SendMessage(string methodName, object value, SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   value:
        //     Optional parameter for the method.
        //
        //   options:
        //     Should an error be raised if the target object doesn't implement the method for
        //     the message?
        public void SendMessage(string methodName);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     Name of the method to call.
        //
        //   value:
        //     Optional parameter for the method.
        //
        //   options:
        //     Should an error be raised if the target object doesn't implement the method for
        //     the message?
        public void SendMessage(string methodName, object value);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     Name of method to call.
        //
        //   value:
        //     Optional parameter value for the method.
        //
        //   options:
        //     Should an error be raised if the method does not exist on the target object?
        public void SendMessageUpwards(string methodName, SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     Name of method to call.
        //
        //   value:
        //     Optional parameter value for the method.
        //
        //   options:
        //     Should an error be raised if the method does not exist on the target object?
        [ExcludeFromDocs]
        public void SendMessageUpwards(string methodName, object value);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     Name of method to call.
        //
        //   value:
        //     Optional parameter value for the method.
        //
        //   options:
        //     Should an error be raised if the method does not exist on the target object?
        [FreeFunction(HasExplicitThis = true)]
        public void SendMessageUpwards(string methodName, [Internal.DefaultValue("null")] object value, [Internal.DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     Name of method to call.
        //
        //   value:
        //     Optional parameter value for the method.
        //
        //   options:
        //     Should an error be raised if the method does not exist on the target object?
        [ExcludeFromDocs]
        public void SendMessageUpwards(string methodName);

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2 transform

transform类提供了查找(父,根,子)变换组件、改变位置,角度,大小的功能
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在层级未知情况下查找子物体:

在这里插入图片描述

 //
        // 摘要:
        //     Position of the transform relative to the parent transform.
        public Vector3 localPosition { get; set; }
        //
        // 摘要:
        //     The rotation as Euler angles in degrees.
        public Vector3 eulerAngles { get; set; }
        //
        // 摘要:
        //     The rotation as Euler angles in degrees relative to the parent transform's rotation.
        public Vector3 localEulerAngles { get; set; }
        //
        // 摘要:
        //     The red axis of the transform in world space.
        public Vector3 right { get; set; }
        //
        // 摘要:
        //     The green axis of the transform in world space.
        public Vector3 up { get; set; }
        //
        // 摘要:
        //     The blue axis of the transform in world space.
        public Vector3 forward { get; set; }
        //
        // 摘要:
        //     The rotation of the transform in world space stored as a Quaternion.
        public Quaternion rotation { get; set; }
        //
        // 摘要:
        //     The world space position of the Transform.
        public Vector3 position { get; set; }
        //
        // 摘要:
        //     The rotation of the transform relative to the transform rotation of the parent.
        public Quaternion localRotation { get; set; }
        //
        // 摘要:
        //     The parent of the transform.
        public Transform parent { get; set; }
        //
        // 摘要:
        //     Matrix that transforms a point from world space into local space (Read Only).
        public Matrix4x4 worldToLocalMatrix { get; }
        //
        // 摘要:
        //     Matrix that transforms a point from local space into world space (Read Only).
        public Matrix4x4 localToWorldMatrix { get; }
        //
        // 摘要:
        //     Returns the topmost transform in the hierarchy.
        public Transform root { get; }
        //
        // 摘要:
        //     The number of children the parent Transform has.
        public int childCount { get; }
        //
        // 摘要:
        //     The global scale of the object (Read Only).
        public Vector3 lossyScale { get; }
        //
        // 摘要:
        //     Has the transform changed since the last time the flag was set to 'false'?
        [NativeProperty("HasChangedDeprecated")]
        public bool hasChanged { get; set; }
        //
        // 摘要:
        //     The scale of the transform relative to the parent.
        public Vector3 localScale { get; set; }
        //
        // 摘要:
        //     The transform capacity of the transform's hierarchy data structure.
        public int hierarchyCapacity { get; set; }
        //
        // 摘要:
        //     The number of transforms in the transform's hierarchy data structure.
        public int hierarchyCount { get; }

        //
        // 摘要:
        //     Unparents all children.
        [FreeFunction("DetachChildren", HasExplicitThis = true)]
        public void DetachChildren();
        //
        // 摘要:
        //     Finds a child by n and returns it.
        //
        // 参数:
        //   n:
        //     Name of child to be found.
        //
        // 返回结果:
        //     The returned child transform or null if no child is found.
        public Transform Find(string n);
        [Obsolete("FindChild has been deprecated. Use Find instead (UnityUpgradable) -> Find([mscorlib] System.String)", false)]
        public Transform FindChild(string n);
        //
        // 摘要:
        //     Returns a transform child by index.
        //
        // 参数:
        //   index:
        //     Index of the child transform to return. Must be smaller than Transform.childCount.
        //
        // 返回结果:
        //     Transform child by index.
        [FreeFunction("GetChild", HasExplicitThis = true)]
        [NativeThrows]
        public Transform GetChild(int index);
        [NativeMethod("GetChildrenCount")]
        [Obsolete("warning use Transform.childCount instead (UnityUpgradable) -> Transform.childCount", false)]
        public int GetChildCount();
        public IEnumerator GetEnumerator();
        //
        // 摘要:
        //     Gets the sibling index.
        public int GetSiblingIndex();
        //
        // 摘要:
        //     Transforms a direction from world space to local space. The opposite of Transform.TransformDirection.
        //
        // 参数:
        //   direction:
        public Vector3 InverseTransformDirection(Vector3 direction);
        //
        // 摘要:
        //     Transforms the direction x, y, z from world space to local space. The opposite
        //     of Transform.TransformDirection.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        public Vector3 InverseTransformDirection(float x, float y, float z);
        //
        // 摘要:
        //     Transforms the position x, y, z from world space to local space. The opposite
        //     of Transform.TransformPoint.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        public Vector3 InverseTransformPoint(float x, float y, float z);
        //
        // 摘要:
        //     Transforms position from world space to local space.
        //
        // 参数:
        //   position:
        public Vector3 InverseTransformPoint(Vector3 position);
        //
        // 摘要:
        //     Transforms a vector from world space to local space. The opposite of Transform.TransformVector.
        //
        // 参数:
        //   vector:
        public Vector3 InverseTransformVector(Vector3 vector);
        //
        // 摘要:
        //     Transforms the vector x, y, z from world space to local space. The opposite of
        //     Transform.TransformVector.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        public Vector3 InverseTransformVector(float x, float y, float z);
        //
        // 摘要:
        //     Is this transform a child of parent?
        //
        // 参数:
        //   parent:
        [FreeFunction("Internal_IsChildOrSameTransform", HasExplicitThis = true)]
        public bool IsChildOf([NotNull] Transform parent);
        //
        // 摘要:
        //     Rotates the transform so the forward vector points at target's current position.
        //
        // 参数:
        //   target:
        //     Object to point towards.
        //
        //   worldUp:
        //     Vector specifying the upward direction.
        public void LookAt(Transform target, [DefaultValue("Vector3.up")] Vector3 worldUp);
        //
        // 摘要:
        //     Rotates the transform so the forward vector points at worldPosition.
        //
        // 参数:
        //   worldPosition:
        //     Point to look at.
        //
        //   worldUp:
        //     Vector specifying the upward direction.
        public void LookAt(Vector3 worldPosition, [DefaultValue("Vector3.up")] Vector3 worldUp);
        //
        // 摘要:
        //     Rotates the transform so the forward vector points at worldPosition.
        //
        // 参数:
        //   worldPosition:
        //     Point to look at.
        //
        //   worldUp:
        //     Vector specifying the upward direction.
        public void LookAt(Vector3 worldPosition);
        //
        // 摘要:
        //     Rotates the transform so the forward vector points at target's current position.
        //
        // 参数:
        //   target:
        //     Object to point towards.
        //
        //   worldUp:
        //     Vector specifying the upward direction.
        public void LookAt(Transform target);
        public void Rotate(float xAngle, float yAngle, float zAngle);
        //
        // 摘要:
        //     Applies a rotation of eulerAngles.z degrees around the z-axis, eulerAngles.x
        //     degrees around the x-axis, and eulerAngles.y degrees around the y-axis (in that
        //     order).
        //
        // 参数:
        //   eulers:
        //     The rotation to apply.
        //
        //   relativeTo:
        //     Determines whether to rotate the GameObject either locally to the GameObject
        //     or relative to the Scene in world space.
        public void Rotate(Vector3 eulers, [DefaultValue("Space.Self")] Space relativeTo);
        public void Rotate(Vector3 eulers);
        //
        // 摘要:
        //     Applies a rotation of zAngle degrees around the z axis, xAngle degrees around
        //     the x axis, and yAngle degrees around the y axis (in that order).
        //
        // 参数:
        //   relativeTo:
        //     Determines whether to rotate the GameObject either is locally to the GameObject
        //     or relative to the Scene in world space.
        //
        //   xAngle:
        //     Degrees to rotate the GameObject around the X axis.
        //
        //   yAngle:
        //     Degrees to rotate the GameObject around the Y axis.
        //
        //   zAngle:
        //     Degrees to rotate the GameObject around the Z axis.
        public void Rotate(float xAngle, float yAngle, float zAngle, [DefaultValue("Space.Self")] Space relativeTo);
        //
        // 摘要:
        //     Rotates the object around the given axis by the number of degrees defined by
        //     the given angle.
        //
        // 参数:
        //   angle:
        //     The degrees of rotation to apply.
        //
        //   axis:
        //     The axis to apply rotation to.
        //
        //   relativeTo:
        //     Determines whether to rotate the GameObject either locally to the GameObject
        //     or relative to the Scene in world space.
        public void Rotate(Vector3 axis, float angle, [DefaultValue("Space.Self")] Space relativeTo);
        public void Rotate(Vector3 axis, float angle);
        //
        // 摘要:
        //     Rotates the transform about axis passing through point in world coordinates by
        //     angle degrees.
        //
        // 参数:
        //   point:
        //
        //   axis:
        //
        //   angle:
        public void RotateAround(Vector3 point, Vector3 axis, float angle);
        //
        // 参数:
        //   axis:
        //
        //   angle:
        [Obsolete("warning use Transform.Rotate instead.")]
        public void RotateAround(Vector3 axis, float angle);
        [Obsolete("warning use Transform.Rotate instead.")]
        public void RotateAroundLocal(Vector3 axis, float angle);
        //
        // 摘要:
        //     Move the transform to the start of the local transform list.
        public void SetAsFirstSibling();
        //
        // 摘要:
        //     Move the transform to the end of the local transform list.
        public void SetAsLastSibling();
        //
        // 摘要:
        //     Set the parent of the transform.
        //
        // 参数:
        //   parent:
        //     The parent Transform to use.
        //
        //   worldPositionStays:
        //     If true, the parent-relative position, scale and rotation are modified such that
        //     the object keeps the same world space position, rotation and scale as before.
        //
        //   p:
        public void SetParent(Transform p);
        //
        // 摘要:
        //     Set the parent of the transform.
        //
        // 参数:
        //   parent:
        //     The parent Transform to use.
        //
        //   worldPositionStays:
        //     If true, the parent-relative position, scale and rotation are modified such that
        //     the object keeps the same world space position, rotation and scale as before.
        //
        //   p:
        [FreeFunction("SetParent", HasExplicitThis = true)]
        public void SetParent(Transform parent, bool worldPositionStays);
        //
        // 摘要:
        //     Sets the world space position and rotation of the Transform component.
        //
        // 参数:
        //   position:
        //
        //   rotation:
        public void SetPositionAndRotation(Vector3 position, Quaternion rotation);
        //
        // 摘要:
        //     Sets the sibling index.
        //
        // 参数:
        //   index:
        //     Index to set.
        public void SetSiblingIndex(int index);
        //
        // 摘要:
        //     Transforms direction x, y, z from local space to world space.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        public Vector3 TransformDirection(float x, float y, float z);
        //
        // 摘要:
        //     Transforms direction from local space to world space.
        //
        // 参数:
        //   direction:
        public Vector3 TransformDirection(Vector3 direction);
        //
        // 摘要:
        //     Transforms the position x, y, z from local space to world space.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        public Vector3 TransformPoint(float x, float y, float z);
        //
        // 摘要:
        //     Transforms position from local space to world space.
        //
        // 参数:
        //   position:
        public Vector3 TransformPoint(Vector3 position);
        //
        // 摘要:
        //     Transforms vector x, y, z from local space to world space.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        public Vector3 TransformVector(float x, float y, float z);
        //
        // 摘要:
        //     Transforms vector from local space to world space.
        //
        // 参数:
        //   vector:
        public Vector3 TransformVector(Vector3 vector);
        //
        // 摘要:
        //     Moves the transform by x along the x axis, y along the y axis, and z along the
        //     z axis.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        //
        //   relativeTo:
        public void Translate(float x, float y, float z);
        //
        // 摘要:
        //     Moves the transform by x along the x axis, y along the y axis, and z along the
        //     z axis.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        //
        //   relativeTo:
        public void Translate(float x, float y, float z, [DefaultValue("Space.Self")] Space relativeTo);
        //
        // 摘要:
        //     Moves the transform in the direction and distance of translation.
        //
        // 参数:
        //   translation:
        //
        //   relativeTo:
        public void Translate(Vector3 translation);
        //
        // 摘要:
        //     Moves the transform in the direction and distance of translation.
        //
        // 参数:
        //   translation:
        //
        //   relativeTo:
        public void Translate(Vector3 translation, [DefaultValue("Space.Self")] Space relativeTo);
        //
        // 摘要:
        //     Moves the transform by x along the x axis, y along the y axis, and z along the
        //     z axis.
        //
        // 参数:
        //   x:
        //
        //   y:
        //
        //   z:
        //
        //   relativeTo:
        public void Translate(float x, float y, float z, Transform relativeTo);
        //
        // 摘要:
        //     Moves the transform in the direction and distance of translation.
        //
        // 参数:
        //   translation:
        //
        //   relativeTo:
        public void Translate(Vector3 translation, Transform relativeTo);

3 Gamobject

在这里插入图片描述
在这里插入图片描述
一般使用使用该标签的物体进行查找;
在这里插入图片描述
在这里插入图片描述

//
        // 摘要:
        //     Creates a new game object, named name.
        //
        // 参数:
        //   name:
        //     The name that the GameObject is created with.
        //
        //   components:
        //     A list of Components to add to the GameObject on creation.
        public GameObject();
        //
        // 摘要:
        //     Creates a new game object, named name.
        //
        // 参数:
        //   name:
        //     The name that the GameObject is created with.
        //
        //   components:
        //     A list of Components to add to the GameObject on creation.
        public GameObject(string name);
        //
        // 摘要:
        //     Creates a new game object, named name.
        //
        // 参数:
        //   name:
        //     The name that the GameObject is created with.
        //
        //   components:
        //     A list of Components to add to the GameObject on creation.
        public GameObject(string name, params Type[] components);

        //
        // 摘要:
        //     The layer the game object is in.
        public int layer { get; set; }
        [Obsolete("GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf or GameObject.activeInHierarchy.")]
        public bool active { get; set; }
        //
        // 摘要:
        //     The local active state of this GameObject. (Read Only)
        public bool activeSelf { get; }
        //
        // 摘要:
        //     Defines whether the GameObject is active in the Scene.
        public bool activeInHierarchy { get; }
        //
        // 摘要:
        //     Editor only API that specifies if a game object is static.
        public bool isStatic { get; set; }
        //
        // 摘要:
        //     The tag of this game object.
        public string tag { get; set; }
        //
        // 摘要:
        //     Scene that the GameObject is part of.
        public Scene scene { get; }
        public GameObject gameObject { get; }
        //
        // 摘要:
        //     The Rigidbody attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead. (UnityUpgradable)", true)]
        public Component rigidbody { get; }
        //
        // 摘要:
        //     The Rigidbody2D component attached to this GameObject. (Read Only)
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property rigidbody2D has been deprecated. Use GetComponent<Rigidbody2D>() instead. (UnityUpgradable)", true)]
        public Component rigidbody2D { get; }
        //
        // 摘要:
        //     The Camera attached to this GameObject (Read Only). (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property camera has been deprecated. Use GetComponent<Camera>() instead. (UnityUpgradable)", true)]
        public Component camera { get; }
        //
        // 摘要:
        //     The Light attached to this GameObject (Read Only). (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property light has been deprecated. Use GetComponent<Light>() instead. (UnityUpgradable)", true)]
        public Component light { get; }
        //
        // 摘要:
        //     The Animation attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property animation has been deprecated. Use GetComponent<Animation>() instead. (UnityUpgradable)", true)]
        public Component animation { get; }
        //
        // 摘要:
        //     The ConstantForce attached to this GameObject (Read Only). (Null if there is
        //     none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property constantForce has been deprecated. Use GetComponent<ConstantForce>() instead. (UnityUpgradable)", true)]
        public Component constantForce { get; }
        //
        // 摘要:
        //     The Renderer attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property renderer has been deprecated. Use GetComponent<Renderer>() instead. (UnityUpgradable)", true)]
        public Component renderer { get; }
        //
        // 摘要:
        //     The AudioSource attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property audio has been deprecated. Use GetComponent<AudioSource>() instead. (UnityUpgradable)", true)]
        public Component audio { get; }
        //
        // 摘要:
        //     The GUIText attached to this GameObject (Read Only). (Null if there is none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property guiText has been deprecated. Use GetComponent<GUIText>() instead. (UnityUpgradable)", true)]
        public Component guiText { get; }
        //
        // 摘要:
        //     The NetworkView attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property networkView has been deprecated. Use GetComponent<NetworkView>() instead. (UnityUpgradable)", true)]
        public Component networkView { get; }
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property guiElement has been deprecated. Use GetComponent<GUIElement>() instead. (UnityUpgradable)", true)]
        public Component guiElement { get; }
        //
        // 摘要:
        //     The GUITexture attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property guiTexture has been deprecated. Use GetComponent<GUITexture>() instead. (UnityUpgradable)", true)]
        public Component guiTexture { get; }
        //
        // 摘要:
        //     The Collider attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property collider has been deprecated. Use GetComponent<Collider>() instead. (UnityUpgradable)", true)]
        public Component collider { get; }
        //
        // 摘要:
        //     The Collider2D component attached to this object.
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property collider2D has been deprecated. Use GetComponent<Collider2D>() instead. (UnityUpgradable)", true)]
        public Component collider2D { get; }
        //
        // 摘要:
        //     The Transform attached to this GameObject.
        public Transform transform { get; }
        //
        // 摘要:
        //     The HingeJoint attached to this GameObject (Read Only). (Null if there is none
        //     attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property hingeJoint has been deprecated. Use GetComponent<HingeJoint>() instead. (UnityUpgradable)", true)]
        public Component hingeJoint { get; }
        //
        // 摘要:
        //     The ParticleSystem attached to this GameObject (Read Only). (Null if there is
        //     none attached).
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("Property particleSystem has been deprecated. Use GetComponent<ParticleSystem>() instead. (UnityUpgradable)", true)]
        public Component particleSystem { get; }

        //
        // 摘要:
        //     Creates a game object with a primitive mesh renderer and appropriate collider.
        //
        // 参数:
        //   type:
        //     The type of primitive object to create.
        [FreeFunction("GameObjectBindings::CreatePrimitive")]
        public static GameObject CreatePrimitive(PrimitiveType type);
        //
        // 摘要:
        //     Finds a GameObject by name and returns it.
        //
        // 参数:
        //   name:
        [FreeFunction(Name = "GameObjectBindings::Find")]
        public static GameObject Find(string name);
        //
        // 摘要:
        //     Returns a list of active GameObjects tagged tag. Returns empty array if no GameObject
        //     was found.
        //
        // 参数:
        //   tag:
        //     The name of the tag to search GameObjects for.
        [FreeFunction(Name = "GameObjectBindings::FindGameObjectsWithTag", ThrowsException = true)]
        public static GameObject[] FindGameObjectsWithTag(string tag);
        [FreeFunction(Name = "GameObjectBindings::FindGameObjectWithTag", ThrowsException = true)]
        public static GameObject FindGameObjectWithTag(string tag);
        //
        // 摘要:
        //     Returns one active GameObject tagged tag. Returns null if no GameObject was found.
        //
        // 参数:
        //   tag:
        //     The tag to search for.
        public static GameObject FindWithTag(string tag);
        public T AddComponent<T>() where T : Component;
        //
        // 摘要:
        //     Adds a component class of type componentType to the game object. C# Users can
        //     use a generic version.
        //
        // 参数:
        //   componentType:
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component AddComponent(Type componentType);
        //
        // 摘要:
        //     Adds a component class named className to the game object.
        //
        // 参数:
        //   className:
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("GameObject.AddComponent with string argument has been deprecated. Use GameObject.AddComponent<T>() instead. (UnityUpgradable).", true)]
        public Component AddComponent(string className);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //
        //   parameter:
        //
        //   options:
        [ExcludeFromDocs]
        public void BroadcastMessage(string methodName);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //
        //   parameter:
        //
        //   options:
        [FreeFunction(Name = "Scripting::BroadcastScriptingMessage", HasExplicitThis = true)]
        public void BroadcastMessage(string methodName, [Internal.DefaultValue("null")] object parameter, [Internal.DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     or any of its children.
        //
        // 参数:
        //   methodName:
        //
        //   parameter:
        //
        //   options:
        [ExcludeFromDocs]
        public void BroadcastMessage(string methodName, object parameter);
        //
        // 参数:
        //   methodName:
        //
        //   options:
        public void BroadcastMessage(string methodName, SendMessageOptions options);
        //
        // 摘要:
        //     Is this game object tagged with tag ?
        //
        // 参数:
        //   tag:
        //     The tag to compare.
        [FreeFunction(Name = "GameObjectBindings::CompareTag", HasExplicitThis = true)]
        public bool CompareTag(string tag);
        [SecuritySafeCritical]
        public T GetComponent<T>();
        //
        // 摘要:
        //     Returns the component with name type if the game object has one attached, null
        //     if it doesn't.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        public Component GetComponent(string type);
        //
        // 摘要:
        //     Returns the component of Type type if the game object has one attached, null
        //     if it doesn't.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        [FreeFunction(Name = "GameObjectBindings::GetComponentFromType", HasExplicitThis = true, ThrowsException = true)]
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponent(Type type);
        //
        // 摘要:
        //     Returns the component of Type type in the GameObject or any of its children using
        //     depth first search.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //
        // 返回结果:
        //     A component of the matching type, if found.
        [FreeFunction(Name = "GameObjectBindings::GetComponentInChildren", HasExplicitThis = true, ThrowsException = true)]
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInChildren(Type type, bool includeInactive);
        //
        // 摘要:
        //     Returns the component of Type type in the GameObject or any of its children using
        //     depth first search.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //
        // 返回结果:
        //     A component of the matching type, if found.
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInChildren(Type type);
        [ExcludeFromDocs]
        public T GetComponentInChildren<T>();
        public T GetComponentInChildren<T>([Internal.DefaultValue("false")] bool includeInactive);
        //
        // 摘要:
        //     Returns the component of Type type in the GameObject or any of its parents.
        //
        // 参数:
        //   type:
        //     Type of component to find.
        [FreeFunction(Name = "GameObjectBindings::GetComponentInParent", HasExplicitThis = true, ThrowsException = true)]
        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInParent(Type type);
        public T GetComponentInParent<T>();
        public void GetComponents<T>(List<T> results);
        public T[] GetComponents<T>();
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        public Component[] GetComponents(Type type);
        public void GetComponents(Type type, List<Component> results);
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject or any of its children.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //     Should Components on inactive GameObjects be included in the found set?
        [ExcludeFromDocs]
        public Component[] GetComponentsInChildren(Type type);
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject or any of its children.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //     Should Components on inactive GameObjects be included in the found set?
        public Component[] GetComponentsInChildren(Type type, [Internal.DefaultValue("false")] bool includeInactive);
        public void GetComponentsInChildren<T>(bool includeInactive, List<T> results);
        public void GetComponentsInChildren<T>(List<T> results);
        public T[] GetComponentsInChildren<T>();
        public T[] GetComponentsInChildren<T>(bool includeInactive);
        [ExcludeFromDocs]
        public Component[] GetComponentsInParent(Type type);
        public void GetComponentsInParent<T>(bool includeInactive, List<T> results);
        public T[] GetComponentsInParent<T>();
        //
        // 摘要:
        //     Returns all components of Type type in the GameObject or any of its parents.
        //
        // 参数:
        //   type:
        //     The type of Component to retrieve.
        //
        //   includeInactive:
        //     Should inactive Components be included in the found set?
        public Component[] GetComponentsInParent(Type type, [Internal.DefaultValue("false")] bool includeInactive);
        public T[] GetComponentsInParent<T>(bool includeInactive);
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("gameObject.PlayAnimation is not supported anymore. Use animation.Play()", true)]
        public void PlayAnimation(Object animation);
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("GameObject.SampleAnimation(AnimationClip, float) has been deprecated. Use AnimationClip.SampleAnimation(GameObject, float) instead (UnityUpgradable).", true)]
        public void SampleAnimation(Object clip, float time);
        //
        // 参数:
        //   methodName:
        //
        //   options:
        public void SendMessage(string methodName, SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     The name of the method to call.
        //
        //   value:
        //     An optional parameter value to pass to the called method.
        //
        //   options:
        //     Should an error be raised if the method doesn't exist on the target object?
        [ExcludeFromDocs]
        public void SendMessage(string methodName);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     The name of the method to call.
        //
        //   value:
        //     An optional parameter value to pass to the called method.
        //
        //   options:
        //     Should an error be raised if the method doesn't exist on the target object?
        [ExcludeFromDocs]
        public void SendMessage(string methodName, object value);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object.
        //
        // 参数:
        //   methodName:
        //     The name of the method to call.
        //
        //   value:
        //     An optional parameter value to pass to the called method.
        //
        //   options:
        //     Should an error be raised if the method doesn't exist on the target object?
        [FreeFunction(Name = "Scripting::SendScriptingMessage", HasExplicitThis = true)]
        public void SendMessage(string methodName, [Internal.DefaultValue("null")] object value, [Internal.DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options);
        //
        // 参数:
        //   methodName:
        //
        //   options:
        public void SendMessageUpwards(string methodName, SendMessageOptions options);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     The name of the method to call.
        //
        //   value:
        //     An optional parameter value to pass to the called method.
        //
        //   options:
        //     Should an error be raised if the method doesn't exist on the target object?
        [ExcludeFromDocs]
        public void SendMessageUpwards(string methodName);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     The name of the method to call.
        //
        //   value:
        //     An optional parameter value to pass to the called method.
        //
        //   options:
        //     Should an error be raised if the method doesn't exist on the target object?
        [ExcludeFromDocs]
        public void SendMessageUpwards(string methodName, object value);
        //
        // 摘要:
        //     Calls the method named methodName on every MonoBehaviour in this game object
        //     and on every ancestor of the behaviour.
        //
        // 参数:
        //   methodName:
        //     The name of the method to call.
        //
        //   value:
        //     An optional parameter value to pass to the called method.
        //
        //   options:
        //     Should an error be raised if the method doesn't exist on the target object?
        [FreeFunction(Name = "Scripting::SendScriptingMessageUpwards", HasExplicitThis = true)]
        public void SendMessageUpwards(string methodName, [Internal.DefaultValue("null")] object value, [Internal.DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options);
        //
        // 摘要:
        //     ActivatesDeactivates the GameObject, depending on the given true or false/ value.
        //
        // 参数:
        //   value:
        //     Activate or deactivate the object, where true activates the GameObject and false
        //     deactivates the GameObject.
        [NativeMethod(Name = "SetSelfActive")]
        public void SetActive(bool value);
        [NativeMethod(Name = "SetActiveRecursivelyDeprecated")]
        [Obsolete("gameObject.SetActiveRecursively() is obsolete. Use GameObject.SetActive(), which is now inherited by children.")]
        public void SetActiveRecursively(bool state);
        [EditorBrowsable(EditorBrowsableState.Never)]
        [Obsolete("gameObject.StopAnimation is not supported anymore. Use animation.Stop()", true)]
        public void StopAnimation();

参考学习资料:

https://www.bilibili.com/video/BV12s411g7gU?p=120

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值