Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- [UUM-133528] Fixed an issue where using some UV Editor actions would clear a mesh's Lightmap UVs without regenerating them.

## [6.1.2] - 2026-06-11

### Fixed
Expand Down
18 changes: 0 additions & 18 deletions Editor/EditorCore/AutoUVEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,35 +214,19 @@ public static bool OnGUI(ProBuilderMesh[] selection, float width)
{
for (int i = 0; i < selection.Length; i++)
TextureGroupSelectedFaces(selection[i]);

ProBuilderEditor.Refresh();
}

if (GUILayout.Button(gc_BreakSelected))
{
SetTextureGroup(selection, -1);

foreach (var kvp in MeshSelection.selectedFacesInEditZone)
{
kvp.Key.ToMesh();
kvp.Key.Refresh();
kvp.Key.Optimize();
}

SceneView.RepaintAll();

s_AutoUVSettingsDiff["textureGroup"] = false;

ProBuilderEditor.Refresh();
}

/* Select all in current texture group */
if (GUILayout.Button(gc_SelectGroup))
{
for (int i = 0; i < selection.Length; i++)
selection[i].SetSelectedFaces(System.Array.FindAll(selection[i].facesInternal, x => x.textureGroup == textureGroup));

ProBuilderEditor.Refresh();
}

if (GUILayout.Button(gc_Reset))
Expand All @@ -260,8 +244,6 @@ public static bool OnGUI(ProBuilderMesh[] selection, float width)

UVEditing.SplitUVs(selection[i], selection[i].GetSelectedFaces());
}

ProBuilderEditor.Refresh();
}

GUI.backgroundColor = PreferenceKeys.proBuilderLightGray;
Expand Down
3 changes: 3 additions & 0 deletions Editor/EditorCore/UVEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,10 @@
{
pb.ToMesh();
pb.Refresh();
pb.Optimize();

Check warning on line 2620 in Editor/EditorCore/UVEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Editor/EditorCore/UVEditor.cs#L2620

Added line #L2620 was not covered by tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1

pb.Optimize() does not reliably restore the UV2 channel that pb.ToMesh() just cleared. ToMesh() always sets mesh.uv2 = null, while Optimize() only regenerates UV2 when Auto Lightmap UVs is enabled and the mesh contributes GI, or when you pass true. That means meshes with an existing UV2 channel but no ContributeGI flag (or projects with Auto Lightmap UVs turned off) will still lose UV2 after these Auto UV actions. If the goal is to preserve lightmap UVs across this path, this needs Optimize(true) or a path that avoids ToMesh() for metadata-only edits.

🤖 Helpful? 👍/👎

}
ProBuilderEditor.Refresh();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2

This centralized rebuild still runs for the Select Texture Group button, even though that button only changes the face selection (SetSelectedFaces(...)) and does not modify mesh data. Because the outer EndChangeCheck() also trips on that click, a pure selection action now executes ToMesh()/Refresh()/Optimize() on every selected mesh, which can unnecessarily dirty meshes and spend a long time regenerating UV2 on large selections. It would be better to distinguish selection-only actions from mesh-editing actions instead of routing both through the same bool return.

🤖 Helpful? 👍/👎

SceneView.RepaintAll();

Check warning on line 2623 in Editor/EditorCore/UVEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Editor/EditorCore/UVEditor.cs#L2622-L2623

Added lines #L2622 - L2623 were not covered by tests
}

foreach (var kvp in MeshSelection.selectedFacesInEditZone)
Expand Down