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
- The search field has an additional icon that has no functionality
- Splash Image logo is shown after being removed when pressing the Preview button
- Crash on GenerateParticleGeometry when creating certain particles
- HD Sample Buffer returns black for Rendering Layer Mask when Custom Pass Volume is not active
- SpriteRenderer has wrong input color when associated material uses SRPBatcher
Add comment