IEnumerator Start() { yield return(new WaitForEndOfFrame()); //if (!isLocalPlayer && !isServer) return; AIAgent agent = null; if (Mod_ResourceUI.Instance) { Mod_ResourceUI.Instance.gameObject.SetActive(true); } // Collect all the starting units and tell them that they belong to this NetworkPlayer // Probably a bad way of doing it but it will work for now Collider[] cols = Physics.OverlapSphere(transform.position, 200); Helper.LoopList_ForEach <Collider>(cols.ToList <Collider>(), (Collider col) => // Loop action { agent = Helper.GetComponent <AIAgent>(col.gameObject); if (agent && !agent.AgentOwner) { // Tell all clients that this AIAgent belongs to this NetworkPlayer NetworkHandler.ClientInstance.CmdSetAgentOwner(col.gameObject, gameObject); // Add the AIAgent to the list of selectables for this player PlayerSelector.AddSelectable(agent.gameObject); } }); }