Skip to content

Commit

Permalink
Add remove "DevelopmentOnly" on first open
Browse files Browse the repository at this point in the history
  • Loading branch information
vverum committed Dec 7, 2021
1 parent e1d1f17 commit 2a7087c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Editor/BuildObjectRemoverView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ public override void OnActivate(string searchContext, VisualElement rootElement)
rowTemplate = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(BuildObjectRemoverConstants.PACKAGE_PATH + "/SettingsTagViewTemplate.uxml");

SetupView(rootElement);
FillViewContent();

base.OnActivate(searchContext, rootElement);
if (!BuildObjectRemoverSettingsProvider.HasSettings())
{
AddDefaultTag();
}

FillViewContent();

base.OnActivate(searchContext, rootElement);
}

public override void OnDeactivate()
Expand Down Expand Up @@ -180,11 +182,19 @@ private void RevertChanges()

private void AddDefaultTag()
{
string sampleTag = "DevelopmentOnly";
if (!UnityEditorInternal.InternalEditorUtility.tags.Contains(sampleTag))
string defaultTag = "DevelopmentOnly";

if (!UnityEditorInternal.InternalEditorUtility.tags.Contains(defaultTag))
UnityEditorInternal.InternalEditorUtility.AddTag(defaultTag);

var defaultRemove = new RemoveTagData
{
UnityEditorInternal.InternalEditorUtility.AddTag(sampleTag);
}
buildTarget = BuildTarget.NoTarget,
enable = true,
runType = (int)RemoverState.Release,
tag = defaultTag
};
BuildObjectRemoverSettingsProvider.SaveSettings(new List<RemoveTagData>() { defaultRemove });
}

}
Expand Down

0 comments on commit 2a7087c

Please sign in to comment.