Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Generate Lightmap UVs for Editor Combined Mesh

Discussion in 'Global Illumination' started by keninger, Sep 13, 2017.

  1. keninger

    keninger

    Joined:
    Mar 29, 2014
    Posts:
    15
    Hi,

    I have combined meshes in the editor, and the plugin itself did not regenerate lightmap uvs like I could if I just imported the mesh. How can I generate the lightmap UVs in this case?
     
    Rotecks likes this.
  2. Rotecks

    Rotecks

    Joined:
    Dec 17, 2014
    Posts:
    53
    Hey! Did you find solution? I have the same problem :(
     
  3. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    400
  4. Rotecks

    Rotecks

    Joined:
    Dec 17, 2014
    Posts:
    53
    Thank you! It works!
    But sometimes for some meshes I get such error :

    UnityException: You can generate UVs only for meshes with vertices inited.
    UnityEditor.Unwrapping.GeneratePerTriangleUVImpl (UnityEngine.Mesh src, UnwrapParam settings)
    UnityEditor.Unwrapping.GeneratePerTriangleUV (UnityEngine.Mesh src, UnwrapParam settings) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Unwrapping.bindings.cs:43)
    UnityEditor.Unwrapping.GeneratePerTriangleUV (UnityEngine.Mesh src) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Unwrapping.bindings.cs:37)
    UnityEditor.Unwrapping.GenerateSecondaryUVSet (UnityEngine.Mesh src) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Unwrapping.bindings.cs:52)
    StairRailing_Corrector.meshBacker () (at Assets/Units/Rooms/Part_2/Bridge/Scripts/StairRailing_Corrector.cs:330)
    StairRailing_Corrector.UpdateColliders_And_Mesh () (at Assets/Units/Rooms/Part_2/Bridge/Scripts/StairRailing_Corrector.cs:188)
    Bridge_Corrector_Abstract.SaveMeshAsAsset () (at Assets/Units/Rooms/Part_2/Bridge/Scripts/Abstract/Bridge_Corrector_Abstract.cs:73)
    Bridge_Corrector_Abstract_Editor.DrawButtons () (at Assets/Units/Rooms/Part_2/Bridge/Editor/Scripts/Abstract/Bridge_Corrector_Abstract_Editor.cs:12)
    StairRailing_Corrector_GUI_Editor.OnInspectorGUI () (at Assets/Units/Rooms/Part_2/Bridge/Editor/Scripts/StairRailing_Corrector_GUI_Editor.cs:29)
    UnityEditor.InspectorWindow.DoOnInspectorGUI (Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, Boolean wasVisible, UnityEngine.Rect& contentRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Do you know the reason???
     
  5. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    400
    This error is thrown when there are no vertices in the mesh (vertex count is 0). Apart from the mesh simply not having that data, one other reason could be that you called
    Mesh.UploadMeshData
    and passed
    true
    into the
    markNoLongerReadable
    parameter, which will deallocate the CPU-side data.