I have a regular navmesh agent that I want to follow the closest player.
I have a System that finds the nearest entity.
I want to set the agent destination to this entity but I need the game object linked to it in order to set it from a monobehaviour.
What is the simplest way??
Thanks.
The easiest is to create a static variable of type vector3 in the system
1 Like
Hmm, and it could be a workaround, but it won’t get me to the game object in a situation I may need it???
You can add any UnityEngine.Object to the entity via EntityManager.AddComponentObject.
Actual object can be fetched by EntityManager.GetComponentObject or by querying over that type in managed (SystemBase) system.
1 Like
Perfect