HalfADog / Unity-RPGCore-HFSM

59 stars 11 forks source link

AE_FSM和DogFramework.EditorExtension 命名空间丢失? #1

Closed mi1890 closed 9 months ago

HalfADog commented 10 months ago

非常抱歉,目前此问题已解决。

mi1890 commented 10 months ago

HFSMEditorWindow.uml Unknown Type:"TwoPanelSplitViewHorizontalExposed"

编辑器的布局文件好像不全????

HalfADog commented 10 months ago

抱歉,确实少了一个文件,你可以在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;
    }
}
mi1890 commented 10 months ago

抱歉,确实少了一个文件,你可以在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;
  }
}

好的 ~辛苦大佬

mi1890 commented 9 months ago

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打不开编辑器

mi1890 commented 9 months ago

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("StateGraphIMGUI"); parametersContaner = Root.Q("ParametersIMGUI"); stateMachinePathContaner = Root.Q("StateLayerIMGUI"); noticeBoard = Root.Q("Notice"); 这些全都查不到,是不是还是有uxml没有上传??还是TwoPaneSplitViewHorizontalExposed 里面有具体的逻辑没有上传?

辛苦大佬看看

HalfADog commented 9 months ago

就只有一个uxml文件就是HFSMEditorWindow.uxml,这个文件在Editor/Resources下,一开始加载不出来可能是因为我把加载路径写死了,你按照自己的路径重新检查一下是否正确,或者打开uxml文件看能否正确加载。

mi1890 commented 9 months ago

就只有一个uxml文件就是HFSMEditorWindow.uxml,这个文件在Editor/Resources下,一开始加载不出来可能是因为我把加载路径写死了,你按照自己的路径重新检查一下是否正确,或者打开uxml文件看能否正确加载。

我上面的就是修改好的,可以加载的,还是有问题

mi1890 commented 9 months ago

uxml里还是报错,unknowntype:TwoPaneSplitViewHorizontalExposed

mi1890 commented 9 months ago

找到问题了 需要把TwoPaneSplitViewHorizontalExposed的命名空间删除掉才行

mi1890 commented 9 months ago

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;
}

}

mi1890 commented 9 months ago

大佬辛苦~

HalfADog commented 9 months ago

你安装UIToolKit的包了吗,能够正常加载文件的话你试试看那个uxml文件能不能用UIBuilder打开。

HalfADog commented 9 months ago

好的好的👌🏻

mi1890 commented 9 months ago

你安装UIToolKit的包了吗,能够正常加载文件的话你试试看那个uxml文件能不能用UIBuilder打开。

问题是这样的

这个标签里的类名是TwoPaneSplitViewHorizontalExposed 而工程里的是带命名空间的,所以不能正确匹配类型 大佬自己的工程里可能是GUID引用到还是怎么回事,所以估计没问题
HalfADog commented 9 months ago

了解了了解了,抱歉有点粗心了,下次我拿一个空的工程文件测试😂