void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, 120, 170)); GUI.enabled = m_allowToSpawnShape; GUILayout.Label(m_message); if (GUILayout.Button("Spawn box")) { SpawnShape.Broadcast(ShapeType.Box); } if (GUILayout.Button("Spawn sphere")) { SpawnShape.Broadcast(ShapeType.Sphere); } GUI.enabled = true; GUILayout.Space(5); if (GUILayout.Button("Critical Message")) { CriticalMessage.Broadcast(); } m_criticalMessageSubscription.Enabled = GUILayout.Toggle(m_criticalMessageSubscription.Enabled, "Handle critical"); GUILayout.EndArea(); }
void Start() { m_criticalMessageSubscription = CriticalMessage.Subscribe(() => { Debug.Log("Handle critical message"); } , null); }