按照您的那个(二)的步骤进行后,我发现如果返回running的状态的话,会有错误发生,但报的错误没有办法追溯到具体的原因,我推测是running之后的帧与update之后的帧对应不上,所以造成了问题,不知道您遇到过这个问题没有呢?
unsupported type for compare
UnityEngine.Debug:LogError (object)
behaviac.Debug:LogError (string) (at Assets/Scripts/behaviac/runtime/Base/Utils.cs:1268)
behaviac.Debug:Break (string) (at Assets/Scripts/behaviac/runtime/Base/Utils.cs:1289)
behaviac.Debug:Check (bool,string) (at Assets/Scripts/behaviac/runtime/Base/Utils.cs:1227)
behaviac.OperationUtils:Compare<Location> (Location,Location,behaviac.EOperatorType) (at Assets/Scripts/behaviac/runtime/Base/Operation.cs:1942)
behaviac.TValue`1<Location>:Log (behaviac.Agent,string,bool) (at Assets/Scripts/behaviac/runtime/Base/Member.cs:52)
behaviac.Agent:LogVariables (bool) (at Assets/Scripts/behaviac/runtime/Agent/Agent.cs:1360)
behaviac.Agent:btexec () (at Assets/Scripts/behaviac/runtime/Agent/Agent.cs:1670)
Flow:execute_bt () (at Assets/Scripts/behaviac/behaviac_generated/types/Flow.cs:200)
BehaviacHelper:Update () (at Assets/BehaviacHelper.cs:59)
我尝试过的就是,直接返回success 是可以的,但返回running就会有这个问题。
我在behaviachelper中的update是这样写的:
try
{
Flow[] agents = Object.FindObjectsOfType<Flow>();
for (int i = 0; i < agents.Length; i++)
{
agents[i].execute_bt();
}
}
catch (System.Exception e)
{
Debug.LogError("behaviac helper update error: " + e.Message + "\n\n" + e.StackTrace);
}
但如果没有这部分的话,就没有办法更新帧了。不知道这样写有没有问题。我觉得是有问题的,但又不知道怎么改,初次使用unity与behaviac,还请专家可以耐心解答,将非常感谢!