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
Comments (3)
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
- Popup windows spawn on the incorrect monitor when the Editor is placed near the boundary of scaled monitor next to a monitor with different scaling
- Hidden Tabs do not shift into empty space after closing visible Tabs
- [Android] Application not deployed on a device when "activity-alias" is used in the AndroidManifest
- Shader compile process adds shader ID to the constant buffer name when the word "Globals" is being used in Vulkan
- Audio Mixer Snapshot link to the documentation isn’t working
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.