Animation 动画
Inherits from Behaviour,IEnumerable
The animation component is used to play back animations.
animation组件用于播放动画。
You can assign animation clips to the animation component and control playback from your script. The animation system in Unity is weight based and supports: Animation Blending, Additive animations, Animation Mixing, Layers and full control over all aspects of animation playback.
可以指定动画剪辑到动画组件并从脚本控制动画播放。在Unity的动画系统基于权重并且支持动画融合,叠加动画,动画混合,标签和 完全控制动画播放的各个方面。
To play a simple animation use Animation.Play
To cross-fade between animations use Animation.CrossFade
To change how animations wrap (Loop, Once, PingPong) change the WrapMode of the respective AnimationClips in their import settings, or use AnimationState.wrapMode to change it at runtime.
AnimationState can be used to change the layer of an animation, modify playback speed, and for direct control over blending and mixing.
如果想播放一个简单的动画,可以使用Animation.Play;
如果想在动画之间交叉淡入,可以使用Animation.CrossFade;
如果想改变动画模式(循环,一次,乒乓),可以改变动画导入设置里面的动画帧的WrapMode,或者在运行时改变AnimationState.wrapMode的值;
AnimationState可以用于改变动画的层,修改播放速度,并且直接控制融合与混合。
Animation also supports enumerators so you can loop through all AnimationStates like this:
动画也支持枚举,所以你可以像这样在AnimationStates之间循环:
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public void Awake() {
foreach (AnimationState state in animation) {
state.speed = 0.5F;
}
}
}
// Make all animations in this character play at half speed
// 使这个角色的所有动画的播放速度降为一半
for (var state : AnimationState in animation) {
state.speed = 0.5;
}
Variables变量
-
The default animation.
默认的动画剪辑。 -
Should the default animation clip (Animation.clip) automatically start playing on startup.
是否在开始的时候自动播放默认的动画(Animation.clip)。 -
How should time beyond the playback range of the clip be treated?
动画剪辑播放完成之后,应该如何操作? -
Are we playing any animations?
是否在播放任何动画? -
Returns the animation state named name.
返回名称为name的动画状态。 -
When turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies.
如果打开这个选项,动画会在物理循环过程中被执行。这个选项只有在结合运动学刚体的时候才有用。 -
When turned on, Unity might stop animating if it thinks that the results of the animation won't be visible to the user.
如果打开这个选项,Unity可能在它认为用户不会看到当前动画的时候停止播放。 -
Controls culling of this Animation component.
控制动画组件的消隐。 -
AABB of this Animation animation component in local space.
在本地坐标空间这个动画的动画组件的AABB。
Functions函数
-
Stops all playing animations that were started with this Animation.
停止所有当前Animation正在播放的动画。 -
Rewinds the animation named name.
倒播名称为name的动画。 -
Samples animations at the current state.
在当前状态对动画进行采样。 -
Is the animation named name playing?
名为name的动画正在播放吗? -
Plays animation without any blending.
没有任何混合的播放动画。 -
Fades the animation with name animation in over a period of time seconds and fades other animations out.
在一定时间内淡入名称为name的动画并且淡出其他动画。 -
Blends the animation named animation towards targetWeight over the next time seconds.
在接下来的几秒内混合名称为name的动画直到targetWeight。 -
Cross fades an animation after previous animations has finished playing.
在前一个动画播放完成之后淡入淡出下一个动画。 -
Plays an animation after previous animations has finished playing.
在前一个动画播放完成之后直接播放下一个动画。 -
Adds a clip to the animation with name newName.
给动画添加一个名称为newName的动画剪辑。 -
Remove clip from the animation list.
从动画列表移除剪辑。 -
Get the number of clips currently assigned to this animation
取得当前动画的动画剪辑数量。 -
Synchronizes playback speed of all animations in the layer.
同步某层的动画的播放速度。
Inherited members继承成员
Inherited Variables继承变量
-
Enabled Behaviours are Updated, disabled Behaviours are not.
启用行为被更新,禁用行为不更新。
-
The Transform attached to this GameObject (null if there is none attached).
Transform附加到GameObject(游戏物体)(如无附加则为空)。 -
The Rigidbody attached to this GameObject (null if there is none attached).
Rigidbody附加到GameObject(游戏物体)(如无附加则为空)。 -
The Camera attached to this GameObject (null if there is none attached).
Camera附加到GameObject(游戏物体)(如无附加则为空)。 -
The Light attached to this GameObject (null if there is none attached).
Light附加到GameObject(游戏物体)(如无附加则为空)。 -
The Animation attached to this GameObject (null if there is none attached).
Animation附加到GameObject(游戏物体)(如无附加则为空)。 -
The ConstantForce attached to this GameObject (null if there is none attached).
ConstantForce附加到GameObject(游戏物体)(如无附加则为空)。 -
The Renderer attached to this GameObject (null if there is none attached).
Renderer附加到GameObject(游戏物体)(如无附加则为空)。 -
The AudioSource attached to this GameObject (null if there is none attached).
AudioSource附加到GameObject(游戏物体)(如无附加则为空)。 -
The GUIText attached to this GameObject (null if there is none attached).
GUIText附加到GameObject(游戏物体)(如无附加则为空)。 -
The NetworkView attached to this GameObject (Read Only). (null if there is none attached)
NetworkView附加到GameObject(游戏物体)(只读)(如无附加则为空)。 -
The GUITexture attached to this GameObject (Read Only). (null if there is none attached)
GUITexture附加到GameObject(游戏物体)(只读)(如无附加则为空)。 -
The Collider attached to this GameObject (null if there is none attached).
Collider附加到GameObject(游戏物体)(如无附加则为空)。 -
The HingeJoint attached to this GameObject (null if there is none attached).
HingeJoint附加到GameObject(游戏物体)(如无附加则为空)。 -
The ParticleEmitter attached to this GameObject (null if there is none attached).
ParticleEmitter附加到GameObject(游戏物体)(如无附加则为空)。 -
The game object this component is attached to. A component is always attached to a game object.
组件附加的游戏物体。一个组件总是被附加到一个游戏物体。 -
The tag of this game object.
游戏物体的标签。
-
The name of the object. //物体的名字
-
Should the object be hidden, saved with the scene or modifiable by the user?
物体是否被隐藏、保存在场景中或被用户修改?
Inherited Functions继承函数
-
Returns the component of Type type if the game object has one attached, null if it doesn't.
如果游戏物体有一个附加,则返回Type类型的组件,如果没有则为null。 -
-
Returns the component with name type if the game object has one attached, null if it doesn't.
如果游戏物体有一个附加,则返回名字类型组件,如果没有则为null。 -
Returns the component of Type type in the GameObject or any of its children using depth first search.
返回Type类型组件,在GameObject或它的任何子物体使用深度优先搜索,仅返回激活的组件。 -
-
Returns all components of Type type in the GameObject or any of its children.
在GameObject或任何它的子物体,返回全部Type类型组件 -
-
Returns all components of Type type in the GameObject.
在游戏物体返回全部Type类型组件。 -
-
Is this game object tagged tag?
游戏物体有被标记标签么? -
Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour
在游戏物体每一个MonoBehaviour和每一个behaviour的祖先上调用名为methodName的方法。 -
Calls the method named methodName on every MonoBehaviour in this game object.
在游戏物体每一个MonoBehaviour上调用名为methodName的方法。 -
Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
在游戏物体每一个MonoBehaviour和它的全部子物体上调用名为methodName的方法。
-
Returns the instance id of the object.
返回物体的实例ID -
Returns the name of the game object.
返回游戏物体的名称。
Inherited Class Functions继承类函数
-
Does the object exist?
物体是否存在? -
Clones the object original and returns the clone.
克隆原始物体,并返回克隆的物体 -
-
Removes a gameobject, component or asset.
删除一个游戏物体、组件或资源 -
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
立即销毁物体obj,强烈建议使用Destroy代替。 -
Returns a list of all active loaded objects of Type type.
返回Type类型的所有激活的加载的物体列表 -
Returns the first active loaded object of Type type.
返回Type类型第一个激活的加载的物体。 -
Compares if two objects refer to the same
比较如果两个物体相同 -
Compares if two objects refer to a different object
比较如果两个物体不同 -
Makes the object target not be destroyed automatically when loading a new scene.
加载新场景的时候使目标物体不被自动销毁。