How to demolish object to prefragmented reference.

1.	Create Cube, this will be the cube which will be shattered to multiple fragments in Editor. Then these fragments will be used as references for Cube demolition in Play Mode. 

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

3.	Destroy it’s default Box collider.

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

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

6.	Add RayFire Shatter to Brick.

7.	In Voronoi properties set Amount to 10.

8.	Click on the Fragment button to create Brick_root gameobject with fragments as it’s children. Change it’s name to “Brick_root_10”.

9.	Click on Export Last Fragments at the bottom of Shatter UI in order to save all new fragments meshes into mesh asset and in the Save Fragments To Asset window set file name to "Brick_frags_10.asset" and click on Save. New mesh asset file will be created.

This step is needed in order to save all fragments as prefab. When you generate fragments they store all mesh data in the scene. If you create prefab at this moment you will lose all mesh data because prefab can not store mesh data and it can not refer to the scene as the only source of mesh data.

10.	Drag and drop Brick_root_10 object from Hierarchy window to Project window into Assets folder to create prefab. Name it “Brick_root_prefab_10”.

11.	Select the Brick object and click on Delete Last to destroy fragments, we created prefab with all fragments and do not need these fragments in scene anymore.

12.	In Voronoi properties set Amount to 100.

13.	Click on the Fragment button to create Brick_root gameobject with fragments as it’s children. Change its name to “Brick_root_100”.

14.	Click on Export Last Fragments and in the Save Fragments To Asset window set file name to "Brick_frags_100.asset" and click on Save.

15.	Drag and drop Brick_root_100 object from Hierarchy window to Project window into Assets folder to create prefab. Name it “Brick_root_prefab_100”.

16.	Select the Brick object and click on Delete Last.

17.	Destroy Shatter component.

Now we have two prefabs with different amounts of fragments as references for reference demolition.

18.	Add RayFire Rigid component to Brick.

19.	Set Initialization to At Start.

20.	Set Demolition Type to Reference Demolition.

21.	Drag and drop Brick_root_10 to Element 0 and Brick_root_100 to Reference field in Reference Demolition properties.

22.	Start Play Mode, Brick will fall down and will be demolished to randomly pick one of the reference prefab. But it’s scale is bigger than it should be. This is because our Brick scale is [2,1,1] and by default instantiated reference inherits the original object scale.

23.	Turn off Play Mode and select Brick.

24.	In Reference Demolition properties turn off Inherit Scale checkbox.

25.	Start Play Mode. Now Brick demolished to the referenced prefab with the correct scale. 

Now you can create Brick prefab and instantiate it in Play Mode. Every time when Brick prefab will be demolished it will pick a random prefab from Reference List, instantiate it and replace demolished Brick to instantiated prefab.