- Home /
Question by
phatpixels · May 19, 2014 at 12:11 PM ·
animationfloatrandom.rangevar
Have random.range anims access float speed variable
Hello All,
im more of a 3d person than a coder, but happily learning as i go along. im sure the answer is simple. For days now i have been trying to access a var animspeed to drive how fast the random.range animations move along. The animspeed float value is picked up from time script. It all works great on just play.animation....but now im using random.range to play back my animations and it doesnt recognise the float value. Any ideas, thankyou in advance.
pragma strict
var anims = ["Roll", "Spin"];
var model: GameObject;
var animspeed : float;
var other : time;
function Update () {
animspeed = animspeed= 1 ;
//play random anim
model.animation.PlayQueued(anims[Random.Range(0, anims.length)]);
// build speed over time
if (other.score >= 4){
animspeed +=2.5;
}
if (other.score >= 15){
animspeed +=2.5;
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613145401im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers
Is it possible to count Random.range animation playback?? 1 Answer
Can I make animations snap to a frame? 1 Answer
mecanim keep feet planted 0 Answers