Hello,
I have a very weird issue : I am using the wiki's .obj runtime importer (http://wiki.unity3d.com/index.php?title=ObjImporter)
My .obj files have no uv. However, I should be able to -at least- set uniform colors to models once they are imported. What happens is that all the .obj I import with this script are completly black when I add a diffuse shader with a color to them.
I have no clue of what is happening.
The issue seems to come from the generated mesh itself (maybe the UV?).
Do someone knows what is happening here ? Thanks in advance.
Here is the code that calls the ObjImporter :
GameObject newobject = new GameObject();
if (!string.IsNullOrEmpty(path))
{
Mesh holderMesh = new Mesh();
ObjImporter newMesh = new ObjImporter();
holderMesh = newMesh.ImportFile(path);
newobject.AddComponent();
MeshFilter filter = newobject.AddComponent();
filter.mesh = holderMesh;
newobject.GetComponent().material = Resources.Load("Materials/Default", typeof(Material)) as Material;
}
↧