using UnityEngine; /// /// Class that AssignExample will talk to. This code will need to be /// places in a separate .cs file before testing in Unity. (Already /// done for you in the downloads area.) /// public class OtherComponent : MonoBehaviour { #region Methods /// /// Changes the value to display for this component. /// public void SetLastCalled(float f) { this.lastCalled = f; } #endregion #region Events /// /// Draw the last value passed in the upper-right corner. /// void OnGUI() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Value=" + this.lastCalled); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); } #endregion #region Private /// /// Last time value passed from AssignExample. /// private float lastCalled = 0f; #endregion }