Skip to Content
Mastering UI Development with Unity
book

Mastering UI Development with Unity

by Dr. Ashley Godbold
April 2018
Beginner content levelBeginner
468 pages
11h 7m
English
Packt Publishing
Content preview from Mastering UI Development with Unity

Setting Animation Parameters in scripts

You can set the values of the Animator Parameters via scripts using the SetFloat(), SetInteger(), SetBool(), and SetTrigger(), and ResetTrigger() functions of the Animator class. You reference the Animator Parameter variables by the string names assigned to them within the Animator.

To set the Animation Parameters, you first get the Animator on which the Parameters were defined; you can do this with either a public Animator variable or using GetComponent<Animator>(). Then, you call the necessary function on the Animator.

For example, the following script would set the Animator Parameters defined in the following screenshot:

using System.Collections;using System.Collections.Generic;using UnityEngine; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Development with Unity for .NET Developers

Game Development with Unity for .NET Developers

Jiadong Chen
Unity UI Cookbook

Unity UI Cookbook

Francesco Sapio

Publisher Resources

ISBN: 9781787125520Supplemental Content