I am a beginner and am trying to make a 2D game. I am trying to get my character to grow legs once I collect a collectible. Once he grows legs I would like it to have a different walk or move animation. To do this I set up conditions in the animator. I tried to change them in C# but it is not working.
using UnityEngine;
using System.Collections;
public class CharacterController : MonoBehaviour {
bool ball = true;
bool legs = false;
Animator anim;
void Start () {
anim = GetComponent<Animator> ();
}
void Update ()
{
if (ball = true) {
anim.SetBool ("Ball", true);
anim.SetBool ("Legs", false);
hands = false;
legs = false;
}
if (legs = true) {
anim.SetBool ("Legs", true);
anim.SetBool ("Ball", false);
ball = false;
}
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.tag == "Leg Thingy") {
legs = true;
}
}
}