Search Issue Tracker
By Design
Votes
0
Found in
5.3.1f1
Issue ID
764690
Regression
No
Can't get accurate transform.position of a Grid-Set RectTransform in Awake/Start
How to reproduce:
- Open MainScene from the attached project
- Turn on Play Mode
- Camera should locate to an offset Z position from the Red Frame. However, it actually sets to somewhere near the bottom left corner of the World Canvas
- Hitting Next should locate the camera to the correct position of each of the Color Frames
- Leave Play Mode
- Turn off the Grid Component (WorldCanvas -> FrameHolder -> Grid Layout Group)
- Turn on Play Mode
- The Camera should relocate to view the Red Frame, as intended
- It should also locate as intended if SetNewPosition method is in an Update
By Design: The grid system lays out the items during a layout call. Until that time the data is not known. Notice how the Frames under the grid component say "Some values driven by GridLayoutGroup" that means that they are only stored as zero. To correct this you'd need to have it in start and use a coroutine to wait till end of frame
IEnumerator Start(){
yield return new WaitForEndOfFrame();
SetNewPosition();}
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Unity CIL Linker fails on Player build when persistent listeners have "<" and ">" in their XML attribute names
- ”Lighting data asset ‘LightingData’ is incompatible with the current Unity version…” warnings are thrown when saving Indoors (URP) and Outdoors (URP) Scenes as Scene Templates
- [iOS] The screen blinks when transitioning from custom to Unity splash screen
- [macOS] ”Ignoring depth surface load action as it is memoryless” warnings are thrown when taking Game View Snapshot
- UI Builder Inspector scrolls back up when changes on an expanded but not fully displayed Inspector tab are saved
Add comment