apply texture on OBJ files automatically in batchmode

3.5k views Asked by At

I have created a C# script to create unity3D asset bundles automatically via batch mode. When I import FBX files and export them as asset bundles, on instantiation in the app at runtime the textures of FBX files are applied automatically; if while exporting, textures are in same folder and if the texture filename is not changed. But OBJ files never take the textures automatically. OBJ files are exported and also instantiated at runtime in the app but without textures, with the same batch mode script that I use for FBX.

It is important for my project that textures are automatically applied on OBJ files also. How do I do it?

I am using Unity 4.5.0 on a mac.

Thanks!

1

There are 1 answers

1
jainam On BEST ANSWER

Found the solution! Two files are generated when object file is exported from 3D modelling software, one is the .OBJ and other is .MTL. The latter contains texture map information of that particular object file.

If .MTL file is imported along with the .OBJ and textures in the unity project, while exporting asset bundle, unity takes all the textures automatically. When this asset is rendered in the app, all the textures are applied automatically now.