Table of Contents

Playing animations in VCI

This example VCI starts an animation when the grip button is pressed.

Embedding an animation in Unity

On the root object of VCI, add an “Animation” or “Animator” component.
In this example, we use an “Animator”.

Open the Animation window.
On the menu bar, select [Window] > [Animation] > [Animation], OR press Ctrl + 6.

On the Animation window, click Create to create an animation clip.
You may create it in any place easy to find. For this example, we will create a folder called “Animation” and name the file as Anim1.anim.

Now you can edit the animation. For how to edit the animation, refer to Edit animation.

Adding an animation

You can manage multiple animation in VCI.

To add a new animation, from the animation switch drop-down menu, click on [Create New Clip] to create a new animation file.

VCI script

You can play the animation by specifying the name of the animation created.

main.lua
function onUse(use)
    vci.assets._ALL_PlayAnimationFromName("Anim1", false) -- index:0, isLoop:false
end

You can also specify an animation from the Index of the animation (the order the animations are added).

main.lua
function onUse(use)
    vci.assets._ALL_PlayAnimationFromIndex(0, false) -- index:0, isLoop:false
end