I'm using AngryAnt's behave and Starting my behave tree like this:
IEnumerator Start ()
{
OriginalMaxSpeed = GetComponent<AutonomousVehicle>().MaxSpeed;
m_Tree = BLNewBehaveLibrary0.InstantiateTree(
BLNewBehaveLibrary0.TreeType.TrafficCollection_CivilianTrafficTree,
this);
while (Application.isPlaying && m_Tree != null)
{
yield return new WaitForSeconds(1.0f / m_Tree.Frequency);
AIUpdate();
}
}
However using the Unity built-in profiler it's showing this is taking 14ms each time and this script is attached to to every vehicle since it's the behavior for vehicles.
Am I doing something wrong? Should WaitForSeconds be taking this long? What is an alternative to using WaitForSeconds()?