Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
ToggleUpdater.cs
Go to the documentation of this file.
2 using UnityEngine;
3 using UnityEngine.UI;
4 
5 namespace droid.Runtime.Utilities.GameObjects.StatusDisplayer.EventRecipients {
9  [RequireComponent(typeof(Toggle))]
10  [ExecuteInEditMode]
11  public class ToggleUpdater : DataPoller {
14  [SerializeField]
15  Toggle _toggle;
16 
17  // Use this for initialization
20  void Start() { this._toggle = this.GetComponent<Toggle>(); }
21 
26  public override void PollData(dynamic data) {
27  if (data is bool) {
28  if (this._toggle) {
29  this._toggle.isOn = data;
30  }
31  }
32  }
33  }
34 }