====== Playing animations in VCI ====== This example VCI starts an animation when the grip button is pressed. ===== Embedding an animation in Unity ===== {{vci:sample:animation:tutorial_animation1.png?direct&300|}} On the root object of VCI, add an "Animation" or "Animator" component.\\ In this example, we use an "Animator". {{vci:sample:animation:tutorial_animation2.png?direct&300|}} Open the Animation window.\\ On the menu bar, select **[Window] > [Animation] > [Animation]**, OR press **Ctrl + 6**. {{vci:sample:animation:tutorial_animation3.png?direct&300|}} 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 [[en:glb:animation#Edit animation|Edit animation]]. ===== Adding an animation ===== You can manage multiple animation in VCI. {{vci:sample:animation:tutorial_animation4.png?direct&300|}} 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. 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). function onUse(use) vci.assets._ALL_PlayAnimationFromIndex(0, false) -- index:0, isLoop:false end