Could this error be caused by a race condition?

Hi, since implementing the saving system a while back, I have been getting the following error in the console when I go through portals which loads the next scene:

Failed to create agent because it is not close enough to the NavMesh UnityEngine.Behaviour:set_enabled(Boolean)
RPG.Movement.Mover:RestoreState(Object) (at Assets/1.Scripts/Movement/Mover.cs:83)
RPG.Saving.SaveableEntity:RestoreState(Object) (at Assets/1.Scripts/Saving/SaveableEntity.cs:85)
RPG.Saving.SavingSystem:RestoreState(Dictionary`2) (at Assets/1.Scripts/Saving/SavingSystem.cs:114)
RPG.Saving.SavingSystem:Load(String) (at Assets/1.Scripts/Saving/SavingSystem.cs:41)
RPG.SceneManagement.SavingWrapper:Load() (at Assets/1.Scripts/SceneManagement/SavingWrapper.cs:49)
RPG.SceneManagement.d__11:MoveNext() (at Assets/1. Scripts/SceneManagement/Portal.cs:59)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

It happens just as the player is being positioned. I thought it could have been because I did not put the spawn point close enough to the terrain, but that doesn’t seem to make a difference. Also it only happens on some Portals, which is funny because they all have the same scripts.

It doesn’t affect game play, so I am not too worried about it, but I would like to know if a race condition could be the issue here.

Cheers
James

It’s just the NavMesh agent complaining. When you force move the player, unless the player is precisely on the NavMesh (i.e. lands right on the ground exactly), it will show this error. By the next frame, it will “land” on the terrain and be back on the NavMesh.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms