private void InstantiatePrefab() { SpawnPool level_pool = PoolManager.Pools[CurrentLevel.GetCurrentLevelPoolName()]; Transform unit_entity = level_pool.Spawn(unit, transform.position, transform.rotation); if (!Equals(unit_entity.gameObject.GetComponent <BoltEntity>(), null)) { BoltNetwork.Attach(unit_entity.gameObject); } if (!no_movements) { MoveTo move_to = unit_entity.GetComponent <MoveTo>(); move_to.SetCoordinates(coordinates_list); move_to.move_type = move_type; move_to.movement_speed = movement_speed; move_to.rotation_speed = rotation_speed; move_to.wait_time_between_moves = wait_time_between_moves; move_to.no_rotation = no_rotation; move_to.despawn_animation_time = despawn_animation_time; } if (life_time > 0) { LifeTime life = unit_entity.GetComponent <LifeTime>(); life.life_time = life_time; life.despawn_time = despawn_animation_time; if (!life.automatically_start) { life.StartLifeTime(); } } Transform[] allChildren = unit_entity.GetComponentsInChildren <Transform>(); foreach (Transform child in allChildren) { if (child.GetComponent <ParticleSystem>() != null) { child.GetComponent <ParticleSystem>().Play(); } } if (spawn_animation_time > 0) { foreach (Collider collider in GetComponents <Collider>()) { collider.enabled = false; } StartCoroutine(SpawnAnimation()); } }