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

RFI: UI Line Renderer RectTransform position

Open hugoymh opened this issue 1 year ago • 0 comments

While using UILineRenderer Component, it's very easy to trigger the Log Warning:

A Line Renderer component should be on a RectTransform positioned at (0,0,0), do not use in child Objects. For best results, create separate RectTransforms as children of the canvas positioned at (0,0) for a UILineRenderer and do not move.

A peek into the source code reveals that the condition for this warning is:

if (transform.GetComponent<RectTransform>().position != Vector3.zero)

which means it should be putting at World Position (0, 0, 0).

Would like to ask if this is really the intended suggestion? I feel that the condition should be at Local Position (0, 0, 0) instead. Seems very unintuitive to maintain its world position at zero while it's very likely the Line Renderer Component could be layers deep inside the RectTransform hierarchy.

hugoymh avatar Aug 16 '24 06:08 hugoymh