MC Combinable

Combinable is one of the core components that needs to be added to all meshes you want to combine. It is compatible with both Skinned Mesh Renderer and Mesh Renderer components. In most cases, simply adding this component to the mesh will enable the baking process. However, there are additional configuration options and usage details that can help you achieve better results. These details include fine-tuning the settings and understanding how to optimize the combining process for improved outcomes.

Configuration

Key

That keyword used to determine which MC Combinable should be used to combine mesh. The component will find closest parent component that has specified key, or of parent key list is empty.

Note: If you have a parent object with multiple combiners, only the first matching combiner (from top to bottom) will be used. This means that if first combiner doesn't have any keys specified, then only that component will be used.

Is Static

This option controls how you want to bake the mesh.

  • When set to TRUE, the mesh will be baked into a Mesh Renderer and any animations or transform changes will be ignored. This is useful for static meshes that do not require animations or dynamic transformations.

  • When set to FALSE, the mesh will be baked into a Skinned Mesh Renderer. This allows the original animations to be preserved, and any transform changes will be applied to the baked mesh. This is suitable for cases where you want to retain the animated behavior or dynamically move/scale or rotate objects.

Please note that the output renderer will be chosen based on Render Types preferences.

What else?

Updating mesh or materials

The Combiner component does not automatically detect changes in the mesh or material (if Bake Materials is enabled, then even material colors). If you want to update the combined mesh, you need to manually call the UpdateStatus function on the component.

This function will refresh the baked mesh to reflect any modifications made to the underlying mesh or materials. By invoking the UpdateStatus function, you ensure that the combined mesh stays up to date with any changes you have made.

Animation update

When the Combiner bakes a mesh, it will disable the original renderer for that mesh. In such cases, it is important to ensure that the Culling Mode is set to Always Animate on the Animator. Failing to do so may result in animation issues where the animation does not update properly when the mesh is baked. By setting the Culling Mode to Always Animate, you ensure that the animation continues to play correctly even after the mesh has been baked.

Enabled/Disable combinable

To bake or remove a mesh, you can simply enable or disable the Combinable component. When the Combinable component is enabled, the original renderer will be disabled as the mesh gets baked and combined. Conversely, when the Combinable component is disabled, the original renderer will be re-enabled, allowing the mesh to be rendered separately. This enables you to easily control whether the mesh is part of the combined result or rendered individually.

Component cache

To improve baking performance, the Combiner component caches links to the Mesh Renderer, Skinned Mesh Renderer, and Mesh Filter components. However, in rare cases, issues may arise, such as when adding components via a script. If you encounter such issues, it is recommended to call the SetRenderers function on the Combiner component, which will update the cache accordingly.

In general, using prefabs is much faster and more efficient, as there is a custom editor that automatically resets the cache in Editor mode. This means you don't need to manually reset the cache during runtime. Leveraging prefabs with the Combiner component can greatly streamline the process and ensure optimal performance.

You can view the cache value by enabling the debug mode in the inspector. This allows you to inspect and monitor the current cache status, providing visibility into the caching behavior of the Combiner component.

Last updated