Closed mi1890 closed 9 months ago
HFSMEditorWindow.uml Unknown Type:"TwoPanelSplitViewHorizontalExposed"
编辑器的布局文件好像不全????
抱歉,确实少了一个文件,你可以在editor下创建一个同名文件然后复制以下代码,或者等我明天晚上更新一下项目。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
public class TwoPaneSplitViewHorizontalExposed : TwoPaneSplitView
{
public new class UxmlFactory : UxmlFactory<TwoPaneSplitViewHorizontalExposed, UxmlTraits>
{ }
public TwoPaneSplitViewHorizontalExposed()
{
this.orientation = TwoPaneSplitViewOrientation.Horizontal;
}
}
抱歉,确实少了一个文件,你可以在editor下创建一个同名文件然后复制以下代码,或者等我明天晚上更新一下项目。
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UIElements; public class TwoPaneSplitViewHorizontalExposed : TwoPaneSplitView { public new class UxmlFactory : UxmlFactory<TwoPaneSplitViewHorizontalExposed, UxmlTraits> { } public TwoPaneSplitViewHorizontalExposed() { this.orientation = TwoPaneSplitViewOrientation.Horizontal; } }
好的 ~辛苦大佬
NullReferenceException: Object reference not set to an instance of an object RPGCore.AI.HFSM.HFSMEditorWindow.CreateGUI () (at Assets/Unity-RPGCore-HFSM/Editor/Window/HFSMEditorWindow.cs:35)
大佬,uxml文件貌似还是有问题,OpenEditor打不开编辑器
public void CreateGUI() { VisualTreeAsset visualTree = null; var visualTreeAssetPaths = AssetDatabase.FindAssets("HFSMEditorWindow");
foreach (var assetGuid in visualTreeAssetPaths)
{
var assetpath = AssetDatabase.GUIDToAssetPath(assetGuid);
if (assetpath.EndsWith(".uxml"))
{
visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(assetpath);
}
}
if (visualTree == null)
{
Debug.LogError("Can't find HFSMEditorWindow.uxml");
return;
}
//var visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/Scripts/Unity-RPGCore-HFSM/Editor/Resources/HFSMEditorWindow.uxml");
这样修改完,已经可以加载到uxml文件了,但是还是会报错
stateGraphContaner = Root.Q
辛苦大佬看看
就只有一个uxml文件就是HFSMEditorWindow.uxml,这个文件在Editor/Resources下,一开始加载不出来可能是因为我把加载路径写死了,你按照自己的路径重新检查一下是否正确,或者打开uxml文件看能否正确加载。
就只有一个uxml文件就是HFSMEditorWindow.uxml,这个文件在Editor/Resources下,一开始加载不出来可能是因为我把加载路径写死了,你按照自己的路径重新检查一下是否正确,或者打开uxml文件看能否正确加载。
我上面的就是修改好的,可以加载的,还是有问题
uxml里还是报错,unknowntype:TwoPaneSplitViewHorizontalExposed
找到问题了 需要把TwoPaneSplitViewHorizontalExposed的命名空间删除掉才行
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UIElements;
public class TwoPaneSplitViewHorizontalExposed : TwoPaneSplitView { public new class UxmlFactory : UxmlFactory<TwoPaneSplitViewHorizontalExposed, UxmlTraits> { }
public TwoPaneSplitViewHorizontalExposed()
{
this.orientation = TwoPaneSplitViewOrientation.Horizontal;
}
}
大佬辛苦~
你安装UIToolKit的包了吗,能够正常加载文件的话你试试看那个uxml文件能不能用UIBuilder打开。
好的好的👌🏻
你安装UIToolKit的包了吗,能够正常加载文件的话你试试看那个uxml文件能不能用UIBuilder打开。
问题是这样的
了解了了解了,抱歉有点粗心了,下次我拿一个空的工程文件测试😂
非常抱歉,目前此问题已解决。