Search Issue Tracker

By Design

Votes

2

Found in

2018.3

2019.1.0a1

2019.1.5f1

2019.2.0a1

2019.3.0a1

Issue ID

1161502

Regression

No

Changing the position of a RectTransform twice doesn't work when it is instantiated in the same frame

uGUI

-

How to reproduce:
1. Open the attached 'UIBugRepro.zip' project
2. Enter Play Mode
3. Observe created 'UI(Clone)' Game Objects

Expected result: Both cubes get covered by the UI elements
Actual result: Only one of the UI elements does work properly

Reproducible: 2018.4.2f1, 2019.1.6f1, 2019.2.0b6, 2019.3.0a6
Can't reproduce: 2017.4.29f1, 2019.3.0a1, because of 'MissingReferenceException: The variable _uiTemplate of BugRepro doesn't exist anymore.' errors

Notes:
- Workaround: Delete 'ui2.position = new Vector3();' (at Assets/BugRepro.cs:19)

  1. Resolution Note (2019.3.X):

    The user is changing the canvas position which is a driven position. When the calculations are done for where the pivot should be it is using a invalid starting position as the the Canvas will then reposition itself so it lines up where the rendering is expected.

    It is also not good practice to use .position on a rectTransform as its not tracked and it can cause issue with the final calculated position. anchorPosition should be used instead as thats a tracked position.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.