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
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
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.