Question by
SgtCode · Nov 16, 2016 at 12:41 PM ·
c#animator controllerparameters
Animator.SetFloat not working
Hi there guys,
I've come across an odd problem. I have a single animator attached to my gameObject that has two parameters. A float called 'Speed' and a trigger called 'Triggered'. I'm trying to set them in a C# script that is also attached to this gameObject like so:
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
private Animator animator;
void Start(){
animator = GetComponent<Animator>();
}
void Update(){
animator.SetFloat("Speed", 1f);
animator.SetTrigger("Triggered");
}
}
This results in 'Triggered' being set properly but 'Speed' is not changing at all. I do not get any errors. What could the problem be?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612100804im_/https://answers.unity.com/themes/thub/images/avi.jpg)