Skip to content

Instantly share code, notes, and snippets.

@lucas-zimerman
Created June 2, 2022 13:54
Show Gist options
  • Save lucas-zimerman/d46fdcd18c6acc9eb11169645e36ab23 to your computer and use it in GitHub Desktop.
Save lucas-zimerman/d46fdcd18c6acc9eb11169645e36ab23 to your computer and use it in GitHub Desktop.
Sentry Tag for Adventure Creator
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