Hey! i have been making a project and im stuck on this.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterAnimationController : MonoBehaviour
{
public bool walk, jump, run;
public Movement controller;
public Animator anim;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (controller.run && controller.direction.magnitude >= 0.1f)
{
run = true;
}
else if(!controller.run && controller.direction.magnitude < 0.1f)
{
run = false;
}
if (controller.walk)
{
walk = true;
}
else
{
walk = false;
}
if (walk)
{
Debug.Log("walk");
anim.SetBool("Idle", false);
anim.SetBool("Walk", true);
[B] [/B]anim.SetBool("Walk", true); //this part dont work
}
else
{
anim.SetBool("Idle", true);
anim.SetBool("Sprint", false);
anim.SetBool("Walk", false);
}
if (run)
{
anim.SetBool("Idle", false);
anim.SetBool("Sprint", true);
anim.SetBool("Walk", false);
}
else
{
anim.SetBool("Idle", true);
anim.SetBool("Sprint", false);
anim.SetBool("Walk", false);
}
}
}
When im starting the project, if i move animation isn’t enabled (bool)