Skip to content

Fix instance ids#1110

Merged
sim-bz merged 2 commits intorelease/2.10from
fix-instance-ids
Mar 16, 2026
Merged

Fix instance ids#1110
sim-bz merged 2 commits intorelease/2.10from
fix-instance-ids

Conversation

@sim-bz
Copy link
Copy Markdown
Collaborator

@sim-bz sim-bz commented Mar 16, 2026

Purpose of this PR

Quick for remaining InstanceID API calls in 2.10.x

Testing status

[Explanation of what’s tested, how tested and existing or new automation tests. Can include manual testing by self and/or QA. Specify test plans. Rarely acceptable to have no testing.]

  • Added an automated test
  • Passed all automated tests
  • Manually tested

Documentation status

[Overview of how documentation is affected by this change. If there is no effect on documentation, explain why. Otherwise, state which sections are changed and why.]

  • Updated CHANGELOG
  • Updated README (if applicable)
  • Commented all public classes, properties, and methods
  • Updated user documentation

Technical risk

[Overall product level assessment of risk of change. Need technical risk & halo effect.]

Comments to reviewers

[Info per person for what to focus on, or historical info to understand who have previously reviewed and coverage. Help them get context.]

Package version

[Justification for updating either the patch, minor, or major version according to the semantic versioning rules]

  • Updated package version

Copy link
Copy Markdown
Contributor

@u-pr u-pr bot left a comment

Choose a reason for hiding this comment

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

Perfect
The review found one minor optimization opportunity regarding string caching to reduce allocations.

🤖 Helpful? 👍/👎

Comment on lines +196 to +200
#if UNITY_6000_3_OR_NEWER
string CanvasName => "_CM_canvas" + gameObject.GetEntityId();
#else
string CanvasName => "_CM_canvas" + gameObject.GetInstanceID();
#endif
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.

low
The CanvasName property performs string concatenation every time it is accessed. Since the ID of the gameObject remains constant during its lifetime, have you considered caching this string in a private field (e.g., initialized in Awake or lazily)? This would avoid unnecessary heap allocations if the property is accessed frequently during camera updates or UI refreshes.

🤖 Helpful? 👍/👎

@sim-bz sim-bz merged commit 73d3187 into release/2.10 Mar 16, 2026
79 of 80 checks passed
@sim-bz sim-bz deleted the fix-instance-ids branch March 16, 2026 15:34
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.

3 participants