コード例 #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Data = EditorGUILayout.TextField("");

        if (GUILayout.Button("Raise"))
        {
            StringGameEvent gameEvent = target as StringGameEvent;
            gameEvent.Raise(Data);
        }
    }
コード例 #2
0
    /// <summary>
    /// Raises the passed in <see cref="StringGameEvent"/>, after confirming
    /// the name is valid.
    /// </summary>
    /// <param name="eventName">The name of the event.</param>
    /// <param name="value">The string value the event is passing in with.</param>
    public void RaiseStringEvent(string eventName, string value)
    {
        //Raise the Int event if not null, else print an error.
        StringGameEvent stringEvent = this.GetStringEvent(eventName);

        if (!stringEvent)
        {
            Debug.LogError("ERROR: Invalid String Event name: " + eventName + ". Double check Event Constants/your spelling.");
        }
        else
        {
            this.GetStringEvent(eventName).Raise(value);
        }
    }