/// <summary> /// 使用UIElement方式绘制Inspector /// </summary> /// <returns></returns> public override VisualElement CreateInspectorGUI() { var path = AssetDatabase.GetAssetPath(target); // package.json绘制 if (path.ToLower().EndsWith(FileName)) { var root = PackageJsonUI.CreateUI(); root.InitUIElementCommon(packageJsonInfo); root.InitUIElementEditor(packageJsonInfo, path); return(root); } return(base.CreateInspectorGUI()); }
private void OnEnable() { var root = PackageJsonUI.CreateUI(); root.InitUIElementCommon(packageJsonInfo); // 打开创建界面,如果当前有package.json,则绘制编辑界面 if (PackageChecker.HasPackageJson) { root.InitUIElementEditor(packageJsonInfo, PackageChecker.packageJsonPath); } // 否则绘制创建界面 else { root.InitUIElementCreate(packageJsonInfo, PackageChecker.packageJsonPath); } rootVisualElement.Add(root); }