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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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.