I am using puppetmaster and when my AI is in puppet state (unpinned) i want to disable BD and nav mesh agent but when I re enable them i get an error
"get remaining distance can only be called on an active agent" and my AI acts weird! Is there anything that forces nav mesh agent on inside BD? any idea why this is happening?
this is the scripts
"get remaining distance can only be called on an active agent" and my AI acts weird! Is there anything that forces nav mesh agent on inside BD? any idea why this is happening?
this is the scripts
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using RootMotion.Dynamics;
using BehaviorDesigner.Runtime;
public class PuppetNavMEsh : MonoBehaviour
{
public NavMeshAgent navAgent;
public BehaviourPuppet puppet;
public CharNav charnav;
public BehaviorTree behaviorTree;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
navAgent.enabled = puppet.state == BehaviourPuppet.State.Puppet;
if (navAgent.enabled == false)
{
charnav.enabled = false;
behaviorTree.enabled = false;
}
if (navAgent.enabled == true)
{
charnav.enabled = true;
behaviorTree.enabled = true;
}
}
}