How to environment modeling in Play mode.

Combine component allows you to combine multiple meshes into one mesh. This can be useful for enviroment modeling if you want to spread a lot of objects over scene and then bake them into one static mesh. 

1.	Create Cube, this will be a ground cube which will be used for collision.

2.	Set its name to "Ground", position to [0 ,0, 0] and scale to [15, 1, 10]

3.	Create Cube and set its position to [0, 1, 0]

4.	Create Material asset, set it sname to "Red", set its Albedo color to Red and apply to Cube.

5.	Create Sphere and set its position to [0, 5, 0]

6.	Create Material asset, set it sname to "Green", set its Albedo color to Green and apply to Sphere .

You can create more different objects with different materials, but for this tutorial it will be enough just these two objects.

7.	Create empty gameobject, set its name to "Combine" and position to  [0, 0.5, 0]

8.	Add RayFire Combine component to Combine object.

9.	Select Cube and Sphere and in Hierarchy set them as children for Combine object.

10.	Add RayFire Rigid component to Cube and Sphere.

11.	In Rigid component set Initialization to At Start and Demolition Type to Runtime, in Limitations properties set Depth to 2.

12.	Start Play Mode.

Sphere will fall to the Cube and both of them will be demolished to fragments. Some fragments will be demolished again. At this stage you can select some fragments and move them around scene as you want.

Notice that original Cube and Sphere were destroyed and all fragments now children of RayFireMan / Storage_Fragments object. In order to bake them into one mesh you need to set them as children of Combine object.

13.	Select Storage_Fragments object which is child of RayFire Man object and set it as child for Combine object.

14.	Select Combine object and click on Combine button.

MeshFilter with combined mesh and MeshRenderer components will be added to Combine object.

This time we need to save combined mesh in Prefab in order to restore it after Play mode will be turned off. But first we need to export combined mesh into asset so it will be saved in prefab.

15.	Select Storage_Fragments object and destroy it with all fragments.

16.	Select Combine object and in Combine component click on Export Mesh button.

17.	Select Combine object in Hierarchy and drag and drop it in Project window to create prefab.

18.	Turn off Play Mode.

19.	Select Combine prefab in Project window and drag and drop it into scene. 

In this way you can use Combine component to combine demolished and simulated fragments into one mesh object.