您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
1.1 KiB
33 行
1.1 KiB
using UnityEditor.UIElements;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace UnityEngine.Experimental.Perception.Editor
|
|
{
|
|
/// <summary>
|
|
/// Derive this class to force the Unity Editor to render the default inspector using UIElements for an Object that includes a Parameter field.
|
|
/// to allow parameter UIs to render properly
|
|
/// </summary>
|
|
public abstract class ParameterUIElementsEditor : UnityEditor.Editor
|
|
{
|
|
public override VisualElement CreateInspectorGUI()
|
|
{
|
|
var rootElement = new VisualElement();
|
|
CreatePropertyFields(rootElement);
|
|
return rootElement;
|
|
}
|
|
|
|
void CreatePropertyFields(VisualElement rootElement)
|
|
{
|
|
var iterator = serializedObject.GetIterator();
|
|
iterator.NextVisible(true);
|
|
do
|
|
{
|
|
if (iterator.name == "m_Script")
|
|
continue;
|
|
var propertyField = new PropertyField(iterator.Copy());
|
|
propertyField.Bind(serializedObject);
|
|
rootElement.Add(propertyField);
|
|
} while (iterator.NextVisible(false));
|
|
}
|
|
}
|
|
}
|