I have a bunch of environment assets, for instance a group of wall assets named wall1, wall2 etc.
These wall assets all share a single mesh (let's call it wall.fbx), but use a different texture. Before, I simply had a few separate materials with different textures and assigned them to the individual wall assets, but to reduce draw calls I want to use a texture atlas instead.
I've combined all the environmental textures into a single texture map and a single material, which in itself works fine, but now I have to export out separate meshes (wall1.fbx, wall2.fbx etc.) so that the UVs can be different for say, wall1 and wall2. This seems like a badly optimized solution since now I need multiple mesh assets where previously I only needed one.
Is there a better way to do this, perhaps change the UVs for a specific mesh instance in Unity somehow? I see no easy way to do this within the editor aside from overriding the UVs in the material which would defeat the purpose (since I only want a single material to begin with).
Go ahead and use the multiple, imported mesh method. If you were to alter the UV's in Unity, ideally it would be done in the editor, in which case you would end up with a saved, altered instance of the mesh anyway. Maybe if you could alter the mesh and save it as a prefab, without requiring an additional .fbx? As far as I'm aware that is not possible though, since the Mesh Renderer would require Mesh data, you would probably require creating a additional Mesh instance.
Regardless, you would probably create the same number of prefabs, non of which would affect your in-game performance. Lastly, you would, probably, want to combine meshes to further reduce draw calls, which would require changing the UV coordinates, again.
Thanks for the reply - I will use the multiple meshes method. :)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
86 People are following this question.
Procedural Mesh lines with AA
Procedural quad, problem with texture
Why would my texture split across the triangle at runtime?
Applying a texture to a sphere