Im fairly new to scripting and instead of giving up i this time swore to myself to get Answers to make Questions in order to learn c#. That means if you do answer this Question, please explain it for me to understand and learn for the future
My Problem heres is this Error: “An Object Reference is trying to access non-static member : UnityEngine.Animator.Play(string.int)”
and
My Problem heres is this Error: “An Object Reference is trying to access non-static member : UnityEngine.Animator.Play()”
With the Script i want to achieve playing different Animations on different inputs.
Here’s my Code:
using UnityEngine;
using System.Collections;
public class PlayerAnimations : MonoBehaviour {
// Use this for initialization
void Start () {
GetComponent <Animation>();
}
// Update is called once per frame
void Update ()
{
if(Input.GetKey(KeyCode.W))
Animator.Play("Running");
else if(Input.anyKey)
Animation.Play("idle");
}
}