How to full reset A* path find and FollowerEntity to Empty Scene

  • A* version: [5.3.4]
  • Unity version: [2022.3.62f2]

I am trying to full reset my game back to main menu but when I do and the scene loads and enables the new FollowerEntity I get two errors.

You can see the errors at the end of the post. I did my best to leave no trash behind by loading an empty scene and then going back to the main menu, but I’m still getting these errors. I’m not sure how to solve this.

I just want to delete everything, return to the main menu, and be able to select a new character/ load a different save.

Obs: My main menu contains an instance of the player character with FollowerEntity.cs, and the scene has an AstarPath with a RecastGraph.

FollowerEntity.cs errors:
Exception: World.DefaultGameObjectInjectionWorld is null. Has the world been destroyed?
Pathfinding.FollowerEntity.CreateEntity (Unity.Mathematics.float3 position, Unity.Mathematics.quaternion rotation, System.Single scale, Pathfinding.ECS.AgentCylinderShape& shape, Pathfinding.ECS.MovementSettings& movement, Pathfinding.ECS.AutoRepathPolicy& autoRepath, Pathfinding.ECS.ManagedState managedState, Pathfinding.OrientationMode orientation, Pathfinding.ECS.MovementPlaneSource movementPlaneSource, System.Boolean updatePosition, System.Boolean updateRotation, UnityEngine.PhysicsScene physicsScene) (at ./Packages/com.arongranberg.astar/Core/AI/FollowerEntity.cs:417)

340 public static Entity CreateEntity(…); ///long method
417 return entity;

and
NullReferenceException: Object reference not set to an instance of an object
Pathfinding.FollowerEntity.Start () (at ./Packages/com.arongranberg.astar/Core/AI/FollowerEntity.cs:431)

431 var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

It appears that I have to move objects out of DDOL scene before deleting I did a test by hand dragging them out and appears do not fire the error will try a code approach tomorrow. I don’t really understand the reason but it is some ECS something

Can confirm it works now the issue was having the object on the DDOL scene. after moving it out and loading the main menu it works fine

For clarity’s sake, what are you referring to by DDOL?

Don’t Destroy On Load. this is solved so its fine not sure If I have to mark somewhere that the issue is solved

using UnityEngine;
public class DDOL : MonoBehaviour{

public void Awake()
{

 DontDestroyOnLoad(gameObject); 

}

}

1 Like