Hello, I’m making my first 2D project on unity and I Followed a tutorial to animate my sprite but when I enter my code, the console tells me :
“Assets/Scripts/Animator.cs(20,18): error CS1061: Type Animator' does not contain a definition for SetInteger’ and no extension method SetInteger' of type Animator’ could be found. Are you missing an assembly reference?”.
My code :
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Animator : MonoBehaviour {
Animator anim;
void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
if (Input.GetKey(KeyCode.D))
{
anim.SetInteger("Direction", 1);
}
if (Input.GetKeyUp(KeyCode.D))
{
anim.SetInteger("Direction", 0);
}
}
}
Thank you for your help.