com.unity.uiextensions icon indicating copy to clipboard operation
com.unity.uiextensions copied to clipboard

BUG: UI Line Connector Visual Issue when moving parent container

Open ferrouslights opened this issue 2 years ago • 5 comments

Unity UI Extensions Bug Report

Describe the bug

When putting the line connector and the rectTransforms you are connecting in the same parent GameObject, If you move the parent, the line connector doubles its movement compared to the connected objects.

To Reproduce

  1. Create a parent RectTransform
  2. Place 2 RectTransforms to connect and a UI line renderer + UI line connector inside parent
  3. Connect line connector to the two RectTransforms
  4. Move parent container in a direction
  5. Observe parallax effect due to increased line movement in comparison to the 2 RectTransforms it connects

Expected behavior

Lines would move as normal in the same way as the RectTransforms it connects

Actual behavior

Line renderer + connector moves double compared to connected RectTransforms

Screenshots

N/A

Your Setup

  • Operation System:
    • [ ] Windows
    • [x] MacOs
    • [ ] Linux
    • [ ] Other
  • Unity Version: 2021.3.19f
  • Unity UI Extensions Version
    • [x] 2.2.7

Additional context

N/A

ferrouslights avatar Apr 25 '23 14:04 ferrouslights

Thanks for the report @ferrouslights , will investigate.

SimonDarksideJ avatar May 04 '23 11:05 SimonDarksideJ

Hi @ferrouslights , not sure if you are still tracking this issue as it has been a while, sorry about that.

So the root cause of your issue is the current limitation that the Line render component (currently) MUST remain at origin, it doesn't have to be within another Rect Transform (can be anywhere in the canvas scene, but preferably in its own component in the center of the canvas.

I had worked some time ago to account for the distance from origin, but the Unity rendering system does not make this easy.

The best resolution for now, is to have your LineRender(UI Connector) components in separate RectTransforms at 0,0,0

As shown below: image

  • Container Line Renderer - Origin 0,0
  • Container - 262,63

I shall update the docs to make this clearer, and add a warning to the UI LineRenderer if its position moves from 0,0,0

SimonDarksideJ avatar Jun 17 '23 16:06 SimonDarksideJ

Updated docs and the UILineRenderer to be more clear on how to create a UILineRenderer in the scene, which should only ever be positioned at (0,0,0), because Unity...

SimonDarksideJ avatar Jun 17 '23 17:06 SimonDarksideJ

It was worth a shot -- thank you for checking! Love the package btw.

ferrouslights avatar Jun 17 '23 17:06 ferrouslights

It's just a case of restructuring components in the scene, the "parent container" you mention simply doesn't need the Line COnnector/LIne Renderer, just move that to a separate GO parented to the canvas and positioned at (0,0,0). The container with the objects that are connected can then be moved anywhere without issue.

SimonDarksideJ avatar Jun 17 '23 22:06 SimonDarksideJ

Resolved with #480

SimonDarksideJ avatar Oct 04 '24 10:10 SimonDarksideJ