Zyar
July 10, 2013, 1:28pm
1
My models I’m importing from SketchUp (fbx files) are importing with dark textures. I went looking for why and found this:
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
where it was suggested to change material color to white, which appears to have solved the problem but I still have to do this with every texture individually. Is there a way to keep the main color of materials white on import?
You need to use OnPostprocessModel to process it.
This will change all the materials of a model to white colour on import (Place it to Editor/ModelPostProcessor.js) .
public class ModelPostProcessor extends AssetPostprocessor {
function OnPostprocessModel(g : GameObject) {
ChangeMaterialRecursively(g.transform);
}
function ChangeMaterialRecursively(go : Transform) {
for(var child : Transform in go) {
if(child.gameObject.GetComponent.<Renderer>() != null)
for(var mat in child.renderer.sharedMaterials)
mat.mainColor = Color.white;
ChangeMaterialRecursively(child);
}
}
}
Sources:
AssetPostprocessor
AssetPostprocessor.OnPostprocessModel
http://answers.unity3d.com/questions/55118/changing-texture-import-default-settings.html
http://answers.unity3d.com/questions/57644/how-to-change-default-setting-for-imported-assets.html
http://answers.unity3d.com/questions/12187/import-settings.html
–David–