Works with Magio version 1.0.0+
Example 1: You have a huge amount of box prefabs on the scene. You want to convert them all to magio, but with each active Magio object there is a small overhead.
Example 2: You are using Instance Indirect or some other GPU instancing using renderer. The method you are using spawns colliders and uses GPU to draw meshes. You want to use Magio with all objects.
- Enable MagioEngine->Enable Mesh Prefab Replacers
- Open the prefab you want to use. Duplicate all the materials (If you do not want to use Magio materials on your in-active object).
- Duplicate the prefab.
- Drag the duplicated prefab to the scene and convert it to Magio Object normally.
- You should now have two prefabs with two different materials.
- Attach a “Magio Mesh Prefab Replacer” component to the “normal” object without any Magio components. Assign the Magio Object you just created as the variant.
- Now your “normal” prefab should be replaced at runtime with Magio prefab.
- (Optional) If you want to have custom functionality done when the prefab is being replaced, e.g. mask an instance on renderer or something else, you can implement a class which inherits Magio Mesh Prefab Replacer. An example is here: