Skip to content

Fixed issue where selecting edge would select another edge #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 25, 2025

Conversation

varinotmUnity
Copy link
Contributor

@varinotmUnity varinotmUnity commented Jul 9, 2025

Purpose of this PR

The bug was caused by the camera clipping an edge, where one of its vertices was behind the camera's near plane. This led to the point inverting itself, causing the edge to flip direction and resulting in incorrect edge selection. To fix this, I implemented logic to clip edge points against the camera's near plane, ensuring that edges partially behind the camera are correctly processed. A new method (ClipPointToNearPlane) calculates the intersection of points with the near plane, and ProcessEdgePoints ensures accurate handling of edges with one or both vertices behind the camera. This resolves the issue of incorrect edge selection and ensures proper edge rendering and interaction.

Links

https://jira.unity3d.com/browse/PBLD-241

Comments to Reviewers

N/A

…ld happen when one of the edge point was behind the camera near plane, and was fixed by clipping that point behind the camera to the plane.
@varinotmUnity varinotmUnity self-assigned this Jul 9, 2025
@unity-cla-assistant
Copy link

unity-cla-assistant commented Jul 9, 2025

CLA assistant check
All committers have signed the CLA.

@codecov-github-com
Copy link

codecov-github-com bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Editor/EditorCore/EditorSceneViewPicker.cs 95.45% 3 Missing ⚠️
@@            Coverage Diff             @@
##           master     #614      +/-   ##
==========================================
+ Coverage   33.05%   33.66%   +0.60%     
==========================================
  Files         277      277              
  Lines       34736    34785      +49     
==========================================
+ Hits        11483    11709     +226     
+ Misses      23253    23076     -177     
Flag Coverage Δ
mac_trunk 33.45% <95.45%> (+0.58%) ⬆️
win_trunk 33.35% <95.45%> (+0.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Editor/EditorCore/EditorSceneViewPicker.cs 50.34% <95.45%> (+24.72%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@TimAidleyAtUnity TimAidleyAtUnity left a comment

Choose a reason for hiding this comment

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

Great PR. I really like the comprehensive set of tests you've added.

Copy link
Collaborator

@zatzuri-unity zatzuri-unity left a comment

Choose a reason for hiding this comment

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

Tested:

  • Repro steps on repro project
  • Repro steps on blank project using a new PB cube
  • Selecting/unselecting multiple edges with ctrl/cmd
  • Performing actions with the selected edges
  • Undo/redo
  • Switched between edge, vertex, and face selection
  • Selected edges, vertices, and faces outside of the camera
  • Since bisection shows that the fix for PBLD-241 caused this issue, I also reproed the steps for that bug to ensure that fix is still working as intended

CHANGELOG.md Outdated
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [PBLD-231] Fixed a bug where Extrude was not being disabled in the context menu when 'allow non-manifold actions' was not selected in the ProBuilder preferences.
- [PBLD-238] Fixed a bug that could cause users to lose any work that they did on a ProBuilder mesh between two usages of tool actions that had previews (options overlays).
- [PBLD-222] Fixed crash by preventing user from probuilderizing a gameobject that has isPartOfStaticBatch set to true.
- [PBLD-242] Fixed a bug where edges were being incorrectly selected when one or both vertices were behind the camera's near plane, causing flipped lines and inconsistent selection behavior.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be under in a new section (unreleased or 6.0.7) since we just released 6.0.6

@varinotmUnity varinotmUnity added the bug Something isn't working label Jul 24, 2025
@varinotmUnity varinotmUnity merged commit 02c4c28 into master Jul 25, 2025
11 checks passed
@varinotmUnity varinotmUnity deleted the bugfix/edge-hover-selection-fix branch July 25, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants