void Check_Dispose(Pool_Object pool_objects) //parallel axis offscreen { if (pool_objects.transform.position.x < (-default_spawn_pos.x * Camera.main.aspect) / target_aspect) { pool_objects.Dispose(); pool_objects.transform.position = Vector3.one * 1000; } }
void Configure() { target_aspect = target_aspect_ratio.x / target_aspect_ratio.y; pool_objects = new Pool_Object[pool_size]; for (int i = 0; i < pool_objects.Length; i++) { GameObject go = Instantiate(Prefab) as GameObject; Transform t = go.transform; t.SetParent(transform); t.position = Vector3.one * 1000; pool_objects[i] = new Pool_Object(t); } if (spawn_immediate) { Spawn_Immediate(); } }