Material doesn't stay in MeshInstance after unwrapping UV2

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By winterlx

Hey, I’m having an annoying issue while trying to bake lights on my project:

Every time I unwrap UV2 for Lightmap/AO, my material is removed from my mesh instance node.

Steps to reproduce:

  1. In Material> Create New SpatialMaterial
  2. In Albedo> Insert wanted texture
  3. UV2> Enable
  4. Under mesh at the top> UV2 for Lightmap/AO
  5. Go on another part of the parent node and come back

(For visuals Imgur: The magic of the Internet )

By this point, the material disappeared…
I don’t know what I’m doing wrong but it’s driving me nuts @_@

Please let me know what I’m doing wrong / how to resolve this issue please!!!

:bust_in_silhouette: Reply From: Calinou

This is expected, as UV2 cannot be saved into mesh files by Godot (which are usually external files such as .obj).

Instead, you need to select the 3D scene in the FileSystem dock, then the light baking mode to generate lightmaps in the Import dock on the 3D scene. For OBJ meshes, you will need to change their import mode to OBJ As Scene instead of importing them as a standalone mesh.

This is explained in detail in the Baked lightmaps documentation.