Quantcast
Channel: Latest Questions by GraviterX
Viewing all articles
Browse latest Browse all 122

Animation Play On Click

$
0
0
Hey all. I'm trying to script a function in which an animation plays on click of a gameobject. However, instead of naming the animation in the parenthesis, I want to be able to declare it as a variable, so I can use the script for multiple gameobjects so I don't have many scripts for different animations. However, I'm getting an error. Any help? Error: Assets/Scripting/Click to move.js(7,17): BCE0004: Ambiguous reference 'animation': Click to move.animation, UnityEngine.Component.animation. var animation : Animation; function Update() { if(Input.GetMouseButtonDown(0)) { animation = AnimationClip; animation.Play(); } }

Viewing all articles
Browse latest Browse all 122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>