I'd like to add extra procedural geometry / materials to an authored mesh at import time. I have a custom
AssetPostprocessor script that creates a new, larger,
Material array with the additional materials appended, assigns it to
renderer.sharedMaterials, sets the appropriate value to
renderer.sharedMesh.subMeshCount, and performs the
However, Unity appears to promptly discard the new materials, resetting the content of
renderer.sharedMaterials to just the materials present in the fbx, by the time Start() is called on monobehaviours attached to the parent gameobject - although the submesh count remains what I set it to, and the extra geometry is still present.
Why does this happen? What is the correct way of adding extra materials to a mesh?
Jun 24 '11 at 09:30 AM