Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using UnityEditor;
using UnityEngine.UIElements;
namespace Breakout.Specs.Editor
{
[CustomEditor(typeof(BallSpecAsset))]
public class BallSpecAssetEditor : UnityEditor.Editor
{
private VisualElement root;
private VisualTreeAsset tree;
private void OnEnable()
{
root = new VisualElement();
tree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(
"Assets/Scripts/Specs/Editor/BallSpecAssetTemplate.uxml");
var style = AssetDatabase.LoadAssetAtPath<StyleSheet>(
"Assets/Scripts/Specs/Editor/BallSpecAssetStyles.uss");
root.styleSheets.Add(style);
}
public override VisualElement CreateInspectorGUI()
{
root.Clear();
tree.CloneTree(root);
return root;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.