Created
June 2, 2022 13:54
-
-
Save lucas-zimerman/d46fdcd18c6acc9eb11169645e36ab23 to your computer and use it in GitHub Desktop.
Sentry Tag for Adventure Creator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AC; | |
using Sentry; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
[System.Serializable] | |
public class ActionSentryTag : Action | |
{ | |
public enum SentryTagEnum | |
{ | |
Set, | |
Remove | |
}; | |
public override ActionCategory Category { get { return ActionCategory.Custom; } } | |
public override string Title { get { return "Sentry Tag"; } } | |
public override string Description { get { return "Does sometihing."; } } | |
public SentryTagEnum TagOption; | |
public string TagName; | |
public string TagValue; | |
public override float Run() | |
{ | |
if (TagOption == SentryTagEnum.Set) | |
{ | |
SentrySdk.ConfigureScope(scope => scope.SetTag(TagName, TagValue)); | |
} | |
else | |
{ | |
SentrySdk.ConfigureScope(scope => scope.UnsetTag(TagName)); | |
} | |
isRunning = false; | |
return 0f; | |
} | |
#if UNITY_EDITOR | |
public override void ShowGUI() | |
{ | |
TagOption = (SentryTagEnum)EditorGUILayout.EnumPopup("Option", TagOption); | |
TagName = EditorGUILayout.TextField("Tag Name", TagName); | |
if (TagOption == SentryTagEnum.Set) | |
{ | |
TagValue = EditorGUILayout.TextField("Value", TagValue); | |
} | |
} | |
public override string SetLabel() => string.Empty; | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment