增加错误提示

This commit is contained in:
shenjianxing 2024-12-31 17:27:27 +08:00
parent 1de8149678
commit 46e28cbf9c
2 changed files with 11 additions and 1 deletions

View File

@ -19,7 +19,7 @@ public class MoveAction : IAction
Vector3 pos; Vector3 pos;
float time; float time;
string path; string path;
public static MoveAction Allocate(string path , Vector3 pos, float time, System.Action onDelayFinish = null) public static MoveAction Allocate(string path, Vector3 pos, float time, System.Action onDelayFinish = null)
{ {
var retNode = mPool.Allocate(); var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.ActionID = ActionKit.ID_GENERATOR++;
@ -53,6 +53,12 @@ public class MoveAction : IAction
public void OnStart() public void OnStart()
{ {
GameObject obj = Utility.FindObj(path); GameObject obj = Utility.FindObj(path);
if (obj == null)
{
Debug.LogError($"没有找到路径{path}");
return;
}
obj.transform.DOMove(pos, time).onComplete = () => this.Finish(); ; obj.transform.DOMove(pos, time).onComplete = () => this.Finish(); ;
} }

View File

@ -41,6 +41,10 @@ namespace QFramework.Example
point.name = (i + 1).ToString(); point.name = (i + 1).ToString();
pointMap.Add(obj, point); pointMap.Add(obj, point);
} }
else
{
Debug.LogError($"没有找到路径{path}");
}
} }
} }