- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
- 纳金币
- 38268
- 精华
- 111
|
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***ntime.
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之间循环:
C#
JavaScript
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变量
clip
The default animation.
默认的动画剪辑。
playAutomatically
Should the default animation clip (Animation.clip) automatically start playing on startup.
是否在开始的时候自动播放默认的动画(Animation.clip)。
wrapMode
How should time beyond the playback range of the clip be treated?
动画剪辑播放完成之后,应该如何操作?
isPlaying
Are we playing any animations?
是否在播放任何动画?
this [string name]
Returns the animation state named name.
返回名称为name的动画状态。
animatePhysics
When turned on, animations will be***cuted in the physics loop. This is only useful in conjunction with kinematic rigidbodies.
如果打开这个选项,动画会在物理循环过程中被执行。这个选项只有在结合运动学刚体的时候才有用。
animateOnlyIfVisible
When turned on, Unity might stop animating if it thinks that the results of the animation won't be visible to the user.
如果打开这个选项,Unity可能在它认为用户不会看到当前动画的时候停止播放。
cullingType
Controls culling of this Animation component.
控制动画组件的消隐。
localBounds
AABB of this Animation animation component in local space.
在本地坐标空间这个动画的动画组件的AABB。
Functions函数
Stop
Stops all playing animations that were started with this Animation.
停止所有当前Animation正在播放的动画。
Rewind
Rewinds the animation named name.
倒播名称为name的动画。
Sample
Samples animations at the current state.
在当前状态对动画进行采样。
IsPlaying
Is the animation named name playing?
名为name的动画正在播放吗?
Play
Plays animation without any blending.
没有任何混合的播放动画。
CrossFade
Fades the animation with name animation in over a period of time seconds and fades other animations out.
在一定时间内淡入名称为name的动画并且淡出其他动画。
Blend
Blends the animation named animation towards targetWeight over the next time seconds.
在接下来的几秒内混合名称为name的动画直到targetWeight。
CrossFadeQueued
Cross fades an animation after previous animations has finished playing.
在前一个动画播放完成之后淡入淡出下一个动画。
PlayQueued
Plays an animation after previous animations has finished playing.
在前一个动画播放完成之后直接播放下一个动画。
AddClip
Adds a clip to the animation with name newName.
给动画添加一个名称为newName的动画剪辑。
RemoveClip
Remove clip from the animation list.
从动画列表移除剪辑。
GetClipCount
Get the number of clips currently assigned to this animation
取得当前动画的动画剪辑数量。
SyncLayer
Synchronizes playback speed of all animations in the layer.
同步某层的动画的播放速度。
Inherited members继承成员
Inherited Variables继承变量
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
启用行为被更新,禁用行为不更新。
transform
The Transform attached to this GameObject (null if there is none attached).
Transform附加到GameObject(游戏物体)(如无附加则为空)。
rigidbody
The Rigidbody attached to this GameObject (null if there is none attached).
Rigidbody附加到GameObject(游戏物体)(如无附加则为空)。
camera
The Camera attached to this GameObject (null if there is none attached).
Camera附加到GameObject(游戏物体)(如无附加则为空)。
light
The Light attached to this GameObject (null if there is none attached).
Light附加到GameObject(游戏物体)(如无附加则为空)。
animation
The Animation attached to this GameObject (null if there is none attached).
Animation附加到GameObject(游戏物体)(如无附加则为空)。
constantForce
The ConstantForce attached to this GameObject (null if there is none attached).
ConstantForce附加到GameObject(游戏物体)(如无附加则为空)。
renderer
The Renderer attached to this GameObject (null if there is none attached).
Renderer附加到GameObject(游戏物体)(如无附加则为空)。
audio
The AudioSource attached to this GameObject (null if there is none attached).
AudioSource附加到GameObject(游戏物体)(如无附加则为空)。
guiText
The GUIText attached to this GameObject (null if there is none attached).
GUIText附加到GameObject(游戏物体)(如无附加则为空)。
networkView
The NetworkView attached to this GameObject (Read Only). (null if there is none attached)
NetworkView附加到GameObject(游戏物体)(只读)(如无附加则为空)。
guiTexture
The GUITexture attached to this GameObject (Read Only). (null if there is none attached)
GUITexture附加到GameObject(游戏物体)(只读)(如无附加则为空)。
collider
The Collider attached to this GameObject (null if there is none attached).
Collider附加到GameObject(游戏物体)(如无附加则为空)。
hingeJoint
The HingeJoint attached to this GameObject (null if there is none attached).
HingeJoint附加到GameObject(游戏物体)(如无附加则为空)。
particleEmitter
The ParticleEmitter attached to this GameObject (null if there is none attached).
ParticleEmitter附加到GameObject(游戏物体)(如无附加则为空)。
gameObject
The game object this component is attached to. A component is always attached to a game object.
组件附加的游戏物体。一个组件总是被附加到一个游戏物体。
tag
The tag of this game object.
游戏物体的标签。
name
The name of the object. //物体的名字
hideFlags
Should the object be hidden, saved with the scene or modifiable by the user?
物体是否被隐藏、保存在场景中或被用户修改?
Inherited Functions继承函数
GetComponent
Returns the component of Type type if the game object has one attached, null if it doesn't.
如果游戏物体有一个附加,则返回Type类型的组件,如果没有则为null。
GetComponent.<T>
GetComponent
Returns the component with name type if the game object has one attached, null if it doesn't.
如果游戏物体有一个附加,则返回名字类型组件,如果没有则为null。
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children using depth first search.
返回Type类型组件,在GameObject或它的任何子物体使用深度优先搜索,仅返回激活的组件。
GetComponentInChildren.<T>
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
在GameObject或任何它的子物体,返回全部Type类型组件
GetComponentsInChildren.<T>
GetComponents
Returns all components of Type type in the GameObject.
在游戏物体返回全部Type类型组件。
GetComponents.<T>
CompareTag
Is this game object tagged tag?
游戏物体有被标记标签么?
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour
在游戏物体每一个MonoBehaviour和每一个behaviour的祖先上调用名为methodName的方法。
SendMessage
Calls the method named methodName on every MonoBehaviour in this game object.
在游戏物体每一个MonoBehaviour上调用名为methodName的方法。
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
在游戏物体每一个MonoBehaviour和它的全部子物体上调用名为methodName的方法。
GetInstanceID
Returns the instance id of the object.
返回物体的实例ID
ToString
Returns the name of the game object.
返回游戏物体的名称。
Inherited Class Functions继承类函数
operator bool
Does the object exist?
物体是否存在?
Instantiate
Clones the object original and returns the clone.
克隆原始物体,并返回克隆的物体
Instantiate.<T>
Destroy
Removes a gameobject, component or asset.
删除一个游戏物体、组件或资源
DestroyImmediate
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
立即销毁物体obj,强烈建议使用Destroy代替。
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
返回Type类型的所有激活的加载的物体列表
FindObjectOfType
Returns the first active loaded object of Type type.
返回Type类型第一个激活的加载的物体。
operator ==
Compares if two objects refer to the same
比较如果两个物体相同
operator !=
Compares if two objects refer to a different object
比较如果两个物体不同
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new scene.
加载新场景的时候使目标物体不被自动销毁。
|
|