private void Pool()
 {
     AgentController.CacheAgent(this);
     if (CachedGameObject != null)
     {
         CachedGameObject.SetActive(false);
     }
 }
 /// <summary>
 /// Completes the life of the agent and pools or destroys it.
 /// </summary>
 /// <param name="agent">Agent.</param>
 public static void CompleteLife(LSAgent agent)
 {
     if (agent.CachedGameObject != null)
     {
         agent.CachedGameObject.SetActive(false);
     }
     if (agent.TypeIndex != UNREGISTERED_TYPE_INDEX)
     {
         AgentController.CacheAgent(agent);
     }
     else
     {
         //This agent was not registered for pooling. Let's destroy it
         GameObject.Destroy(agent);
     }
 }