Skip to content

Conversation

@WhythZ
Copy link

@WhythZ WhythZ commented Dec 30, 2025

DO NOT FORGET TO INCLUDE A CHANGELOG ENTRY

Purpose of this PR

There is a problem in the newest release that:

  • When we trigger a copy from an existing ProBuilder-created GameObject in a scene (e.g. Ctrl+C and Ctrl+V)
  • The name of the Mesh of the copied result will be like "pb_MeshXXX (Clone)"
  • If we then make another copy from the "pb_MeshXXX (Clone)", we'll get "pb_MeshXXX (Clone) (Clone)", which is extremely ugly
38667e7f7f8435bc9618a1ae70f2ad2f

It was because of the logic below from MakeUnique function (It will only be called on the copied result when copy happens) in the ProBuilderMeshFunction.cs, it doesn't handle the name of the copied GO's Mesh, so the GO will keep having a Mesh named from the original GO with a '"(Clone)"' suffix

mesh = mesh != null
    ? Instantiate(mesh)
    : new Mesh() { name = $"pb_Mesh{GetInstanceID()}" };

The MakeUnique function was modified by Karl in the PR453, aiming at removing the dependencies on parsing the name of Mesh of a GO to get its InstanceID which will be used to check whether the GO is a copied result or modified result, PR453 also removed all the renaming logics of Mesh except the case when creating Mesh

Therefore my PR is to fix the ugly naming of copied meshes

mesh = mesh != null
    ? Instantiate(mesh)
    : new Mesh();
mesh.name = $"pb_Mesh{GetInstanceID()}";

Links

Jira:

Comments to Reviewers

[List known issues, planned work, provide any extra context for your code.]

@cla-assistant-unity
Copy link

cla-assistant-unity bot commented Dec 30, 2025

CLA assistant check
All committers have signed the CLA.

@u-pr-agent
Copy link

u-pr-agent bot commented Dec 30, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪

The PR contains a very small change (logic simplification) in a single file to address a specific naming issue.
🏅 Score: 95

The change correctly addresses the issue of recursive "(Clone)" suffixes by enforcing a standard naming convention for both instantiated and new meshes.
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected
  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@u-pr-agent
Copy link

u-pr-agent bot commented Dec 30, 2025

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant