-
Heine, Eric R authoredHeine, Eric R authored
GameEventLogger.cs 889 B
using UnityEngine;
using Shared.ScriptableVariables;
namespace Shared.EventLog {
// Logs a game event when it is raised
// Depends on ScriptableVariable package
public class GameEventLogger : GameEventListener {
[Tooltip("The event log to add the event trigger log to")]
public EventLog eventLog;
[Tooltip("The custom key to use in the event log")]
public string customKey;
[Tooltip("The custom value to use in the event log")]
public string customValue;
//---------------------------------------------------------------------------
// Overridden event listening function to add the event to the event log
public override void OnEventRaised() {
eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, string.IsNullOrEmpty(customValue) ? "" : customValue);
base.OnEventRaised();
}
}
}