I’m getting this warning message for just one of the four portal that there are in my scenes. It belongs to the first scene and I’m only getting that error when I go from that portal (scene 1) to the portal on the scene2 and not when I go backwards:
Failed to create agent because it is not close enough to the NavMesh
UnityEngine.StackTraceUtility:ExtractStackTrace ()
RPG.Movement.Mover:RestoreState (object) (at Assets/Scripts/Movement/Mover.cs:68)
RPG.Saving.SaveableEntity:RestoreState (object) (at Assets/Scripts/Saving/SaveableEntity.cs:39)
RPG.Saving.SavingSystem:RestoreState (System.Collections.Generic.Dictionary`2<string, object>) (at Assets/Scripts/Saving/SavingSystem.cs:85)
Here is the Mover line that it complains about:
public void RestoreState(object state)
{
SerializableVector3 position = (SerializableVector3)state;
GetComponent<NavMeshAgent>().enabled = false;
transform.position = position.ToVector();
GetComponent<NavMeshAgent>().enabled = true; // =====> This is the line 68
}
Any advice/assistance would be much appreciate it.
Regards,
Leandro.