- Home /
Question by
topofsteel · Jul 15, 2013 at 06:32 PM ·
c#materialassetpostprocessor
Can I change a material name using AssetPostprocessor.OnPreprocessModel
I would like to change the name of the materials using OnPreprocessModel(). I need to remove oddities, like if someone abbreviated something and used a period in the middle of the name. I've looked at doing it after it's imported, but it seems like I would need to duplicate the material with the correct name, assign it to the renderer, then erase the old material. Is this possible or should I change the name in the source application. Thanks.
Comment
Answer by PAEvenson · Jul 15, 2013 at 06:38 PM
AssetDatabase.RenameAsset should do the trick...
http://docs.unity3d.com/Documentation/ScriptReference/AssetDatabase.RenameAsset.html