Definition
RemoveCyclicAnimation(string prefabInstanceName, string animationClipName, float delayOut)
Description
This function fades out cyclic animation animationClipName of prefab instance prefabInstanceName in a given amount of time. A cyclic animation is an animation that is repeating itself.
Parameters
prefabInstanceName
Specifies the name of the prefab instance. You can also use the name “this” for this parameter. In this case, “this” refers to the prefab instance that this script is attached to.
animationClipName
Specifies the name of the prefab instance animation. To view the name of the prefab instance animations, you can go to the Modify > Properties menu in the prefab editor, or select the name of the prefab instance from the Prefabs and GUIs section in the current VScene and press the Edit button.
delayOut
Specifies the time when the animation animationClipName is completely removed. This value must be 0.0 or higher.
Example 1
function Init() RemoveCyclicAnimation("1_animation_test_boy", "defaultClip", 1.0) end function Update() end
In this example, the RemoveCyclicAnimation function fades out the “defaultClip” animation belonging to the prefab instance “1_animation_test_boy” in 1.0 seconds.
Example 2
--name of script is RemoveCyclicAnimation2.lua animation = true function Init() end function Update() if animation == true then RemoveCyclicAnimation("this", "run", 1.0) animation = false end end
If, in the Prefab Editor, you attach RemoveCyclicAnimation2.lua script to a Prefab that has an animation clip “run”, then “this” parameter in the RemoveCyclicAnimation function will point to instances of that Prefab in current VScene. For example, if you have an Instance named instance1_a from a Prefab named a to which this script is attached, “this” in RemoveCyclicAnimation function refers to the name instance1_a.
In our example, the RemoveCyclicAnimation function fades out the “run” animation belonging to the current prefab instance (for example, instance1_a) in 1.0 seconds.
RemoveCyclicAnimation