Search Issue Tracker
Fixed in 5.3.0
Votes
1
Found in
Issue ID
736161
Regression
Yes
RectTranfrom values of prefab with Canvas are lost after instantiation
How to reproduce:
1. Open the attached project
2. Open and play test scene (it has Test.cs script on Canvas GO which load and instantiate Button prefab with Top-Stretch anchors and then makes it child of Canvas)
3. Notice that button is not just on top, but stretched
4. Or compare coordinates before and after instantiation, it has changed
If Button prefab is dragged to the canvas, it keeps its RectTransform values
Not reproducible: 5.2.0b4
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
- Red spots appear when Blending Lighting Scenarios using Adaptive Probe Volumes
- [Windows] About Unity Window needs to be opened twice to adapt to resolution
- NullReferenceException and temporary graph corruption after entering playmode if output node connection was changed
- Sprite Renderer with Animation does not reflect Sprite changes in the Scene when switching Mask Interaction
- User is redirected to a non-existing online documentation link when clicking on "?" help button inside Inspector window while Animator Override Controller is selected
B16B0SS
Mar 24, 2022 19:32
The suggestion from KARL_JONES does not work in 2022.0.9b
karl_jones
Nov 05, 2015 17:51
Hi. The behavior changed in 5.2 as we fixed a bug causing canvases to not update when instantiated. We will add a delay in so the canvas does not update the rect transform on instantiate, this will maintain the previous behavior.
karl_jones
Nov 05, 2015 17:00
Hey. So this is not actually a bug. What is happening is the GameObject is instantiated at root level and so the Canvas component sets all the values for the screen, note if you change the canvas to a world canvas the values remain untouched. So a simple way to work around this is to disable the canvas in the prefab and then enable it once it has been parented.