using UnityEngine; /// /// Same example as StaticLink, but using SendMessage() to /// communicate instead. This requires both components to /// be attached to the same object. /// public class SendMessage : MonoBehaviour { /// /// Draws the current update count. /// void OnGUI() { GUILayout.Label("UpdateCount=" + updateCount); } /// /// Called via SendMessage() to increate updateCount. /// public void IncrementUpdateCount() { updateCount++; } /// /// Number of times IncrementUpdateCount() has been called. /// private static int updateCount = 0; }