private void InstantitateGO(Vector3 startPos, List <Vector3> wayPoints) { if (GhostHolder.Count == CONTROLLER.maxGhostSpawnCount) { GameObject DelGO = GhostHolder [0]; GhostHolder.RemoveAt(0); Destroy(DelGO); } GameObject GO = Instantiate(ghostGO, new Vector3(startPos.x, 0.5f, startPos.z), Quaternion.identity, GhostParent.transform) as GameObject; GO.name = string.Empty + GhostHolder.Count; GhostHolder.Add(GO); GhostController m_script = GO.GetComponent <GhostController> (); m_script.FollowTargetPath(wayPoints); }