-
-
Save VapidLinus/f6b23956d6ec076f9ded39e254cc790e to your computer and use it in GitHub Desktop.
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 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