Hi, I was trying to start an animation stopped and play it when I press a button, so far I got this:
using UnityEngine;
using System.Collections;
public class animatorcotrols : MonoBehaviour {
void Sart()
{
Animation ["1"].speed = 0;
}
void OnGUI()
{
if(GUI.Button(new Rect(0, 0, 100, 100), "Debug!"))
{
Animation ["1"].speed = 1;
}
}
}
But it says
Assets/animatorcotrols.cs(8,17): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected
I don’t know if I should use this function or is there a better way to do this, I’ve searched everywhere and I can’t find the solution, the worst part is that I’ve done this before and it’s extremely simple but I just can’t, thanks for your help in advance.
Animation is a class and you are trying to use it like an object. If you want to access the Animation connected to a unity object you have to do it like this: