Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0a11
2018.3.0b9
2019.1.0a1
Issue ID
1098050
Regression
Yes
Rect of instantiated rect transform is only resized on second frame
Steps to reproduce:
1. Open attached project
2. Open scene SampleScene
3. Run it
4. In console, notice that there's one RectTransform rect value different from others. This happens because rect transform is only resized in the next frame and not the same one it was instantiated on.
Reproduced with: 2018.3.0a11, 2018.3.0b9, 2019.1.0a1, 2019.1.0a8
Not reproducible: 2018.2.15f1, 2018.3.0a10
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Search: Inspector section icon is less sharp/more pixelated than other editor icons
- Search description string is always truncated
- [VFX] When Grouped Nodes are converted to Subgraph Operator resulting Graph Node is not included in the Group
- Search window icons are less sharp/more pixelated than other editor icons
- The Inspector can be covered when scaling the horizontal separator bar
Resolution Note (2019.1.X):
This is because CanvasScaler is used on this object, which has its own 'Awake' to perform.
The order of Awakes is not guaranteed, and should be considered random. Unfortunately it can have the appearance of being consistent, and can be the same for a given object each time it's run, but is sensitive to change in the underlying Unity codebase, or in the Unity project.
When the CanvasScaler Awakes, it performs calculations based on screen size (or however it's set up), which causes the Canvas to be modified, which in turn causes child rect transforms to be modified.
The best place to 'capture' the initial rect transform is in the Start() method of the component, when all Awakes are guaranteed to have run.