Using Animator

The quick brown fox jumps over the lazy dog

Have you watched this tutorial? It shows you how to do that.

The quick brown fox jumps over the lazy dog

I’ve just uploaded a tutorial to YouTube on setting up an Animation Controller for a character, and in a couple of hours I’ll be uploading the tutorial that describes the scripting needed. I’m keeping my tutorials very simple. Check them out.

The quick brown fox jumps over the lazy dog

You might like to check the Scripting reference

sorry, that was not web. Search for SetBool() method of Animator

eg animator.SetBool(“Alive”, false);

if animator is your instance of the Animator Controller.

Here’s the script I’ll be using - it’s in C#. You use GetComponent() to get a reference to the animator. Of course this script needs to be attached to the object that has an animator.

using UnityEngine;
using System.Collections;

public class IdleWalk : MonoBehaviour 
{
	protected Animator animator;
	public float DirectionDampTime = 0.25f;

	// Use this for initialization
	void Start () 
	{
		animator = GetComponent<Animator>();
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(animator)
		{
			float h = Input.GetAxis("Horizontal");  //left/right arrow keys
			float v = Input.GetAxis("Vertical");	//up/down arrow keys

			animator.SetFloat("Speed", h*h + v*v);
			animator.SetFloat("Direction", h, DirectionDampTime, Time.deltaTime);
		}
	}
}

It’s great to figure out a good solution - programming is mostly about troubleshooting. Good luck with your game development.