| void Start()|
BehaviorTree behaviorTree = gameObject.AddComponent<BehaviorTree>();
behaviorTree.StartWhenEnabled = false;
EntryTask entryTask = new EntryTask();
behaviorTree.GetBehaviorSource().EntryTask = entryTask;
Sequence rootTask = new Sequence();
behaviorTree.GetBehaviorSource().RootTask = rootTask;
WithinSight withinSight = new WithinSight();
withinSight.targetTag = "Enemy";
withinSight.target = new SharedTransform();
MoveTowards moveTowards = new MoveTowards();
moveTowards.target = withinSight.target;
behaviorTree.GetBehaviorSource().HasSerialized = true;
This is my script, but I find when running, WithinSight will be executed and return Success, but the MoveTowards will raise an error for some low-level reason. Can you please tell me why?
Cool. I imported it from package manager, it seems I can't browse the source code. Anyway, this imformation is very helpful. Thanks a lot.If you import the runtime source code from the downloads page you should be able to see the line number that is causing the problem.