AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
AnimButton.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity.Buttons
7 {
11  [RequireComponent(typeof(Animator))]
12  public class AnimButton : Button
13  {
17  private Animator _animator;
18 
22  public override void OnStateChange(ButtonStateEnum newState)
23  {
24  if (_animator == null)
25  {
26  _animator = this.GetComponent<Animator>();
27  }
28 
29  _animator.SetInteger("State", (int)newState);
30 
31  base.OnStateChange(newState);
32  }
33  }
34 }
override void OnStateChange(ButtonStateEnum newState)
On state change swap out the active mesh based on the state
Definition: AnimButton.cs:22
ButtonStateEnum
State enum for buttons.
Mesh button is a mesh renderer interactable with state data for button state
Definition: AnimButton.cs:12