Error code CS0120 - An object reference is required to access non-static member `UnityEngine.Animator.SetBool(string, bool)'


I am new to using Unity and I have came across a problem with a piece of code I have written for my RPG game. This code is meant to allow the character to move but when I click play it comes up with error CS0120. I was maybe wandering if you could look at my code and see what is wrong with it.


P.S I understand it’s quite a simple code but i’m new :slight_smile:

using UnityEngine;
using System.Collections;

public class Playermovement : MonoBehaviour {

	Rigidbody2D rbody;
	Animator anim;

	// Use this for initialization
	void Start () {
		rbody = GetComponent<Rigidbody2D> ();
		anim = GetComponent<Animator> ();

	// Update is called once per frame
	void Update () {
		Vector2 movement_vector = new Vector2 (Input.GetAxisRaw ("Horizontal"), Input.GetAxisRaw ("Vertical"));

		if (movement_vector != {
			UnityEngine.Animator.SetBool ("iswalking", true);
		} else {
			UnityEngine.Animator.SetBool ("iswalking", false);

		rbody.MovePosition (rbody.position + movement_vector * Time.deltaTime);

UnityEngine.Animator.SetBool (“iswalking”, true);

should be:

anim.SetBool ("iswalking", true);