Hey,
I got some lightmapped prefabs and all of that works great for “normal” meshes but fails for ProBuilder meshes. Of course, the reason why its not working is that the UV2 is consistently removed for the mesh in the prefab. I guess even though thats annoying its intentional and I’m okay with that because I figured I could just store the UV2 along with the lightmapIndex, lightmapOffsetScale and work around this limitation this way.
And that actually turned out to work at first! However I made some more changes to the mesh e.g. subdivide and extrude and it broke because the number of vertices stored in the scene mesh isn’t the same as the same one stored in the prefab and thus my UV2 assignment failed. Bummer.
Mesh stats in scene:
491 verts, 658 tris, 2 submeshes uv,uv2
Mesh stats in prefab:
1256 verts, 658 tris, 2 submeshes uv
I thought thats very odd and I got no explanation for this behaviour but it prevents me from working around the UV2 limitation. The next step would be to have another workaround for the workaround by storing the vertices, etc. as well. But its getting ridiculous here because I’m duplicating the mesh and bloating my prefab…
Of course, I could also export an obj, etc. but this isn’t a solution that scales very well because I’d need to re-assign materials, re-add colliders and scripts, etc.
Theres probably ways to work around this with editor tools and such but I’d much rather finish a game.
Looking for some ideas…
Versions:
Unity 2018.4.12f1
ProBuilder 4.1.0