I have a script with a public function which sets up an animation trigger like this:
public class AnimationManager : MonoBehaviour {
public Animator menuAnim;
void Start () {
menuAnim = GetComponent<Animator>();
}
public void Test() {
menuAnim.SetTrigger("Fade");
}
}
Now in a different gameObject i have another script that i want to simply call the function Test. So i made a script that did this:
public class Testing : MonoBehaviour {
void begin(){
AnimationManager.Test();
// other stuff
}
}
But this leads to this error:
An object reference is required to access non-static member `AnimationManager.Test()'
The error occurs in the first line of the begin function.
I am new ish to C# i originally learnt Javascript, so i am a bit confused how i would reference the member in order to call this function.
Hope you can help.