RemoveNonCyclicAnimation(string prefabInstanceName, string animationClipName)
This function removes non-cyclic animation animationClipName of prefab instance prefabInstanceName. Non-cycle animation is an animation that is executed only once instead of repeating.
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.
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.
function Init() RemoveNonCyclicAnimation("1_animation_test_boy", "defaultClip") end function Update() end
In this example, the RemoveNonCyclicAnimation function removes the “defaultClip” animation belonging to the prefab instance “1_animation_test_boy”.
--name of script is RemoveNonCyclicAnimation2.lua animation = true function Init() end function Update() if animation == true then RemoveNonCyclicAnimation("this", "run") animation = false end end
If, in the Prefab Editor, you attach RemoveNonCyclicAnimation2.lua script to a Prefab that has an animation clip “run”, then “this” parameter in the RemoveNonCyclicAnimation 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 RemoveNonCyclicAnimation function refers to the name instance1_a.
In our example, the RemoveNonCyclicAnimation function removes the “run” animation belonging to the current prefab instance (for example, instance1_a).RemoveNonCyclicAnimation