Unity编辑器下方便的ListView
class :UnityEditorInternal.ReorderableList
Draw:
void OnEnable(){
reorderableList = new ReorderableList(serializedObject, prop);
reorderableList.drawElementCallback = (rect, index, isActive, isFocused) =>
{
var element = prop.GetArrayElementAtIndex(index);
rect.height -= 4;
rect.y += 2;
EditorGUI.PropertyField(rect, element);
};
}
void Draw(){
reorderableList.DoLayoutList();
}
本文介绍如何在Unity编辑器中使用UnityEditorInternal.ReorderableList类创建动态列表,通过示例代码展示了如何初始化ReorderableList并自定义元素绘制方式,实现灵活的列表操作。
903

被折叠的 条评论
为什么被折叠?



