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
- Create New Tile Palette dropdown text is not centered and text is cut off
- Volume numeric fields allows adding unlimited number in numeric field which breaks UI, no character limit
- WebGL build dependencies are not refreshed until the Editor is restarted
- “Audio Random Container” allows adding unlimited number in “Audio Clips” numeric field, causing Editor to freeze
- In Deferred rendering path, mixed lights don't render when enabling "Use Rendering Layers" in the Decal renderer feature
Add comment