"Transform.SetParent(parent, false)" to another canvas, the gameobject's anchors was changed incorrect

359 views Asked by At

I have a prefab with canvas component, canvas rendermode setting was "Screen Space - Camera". Now, I intantiated the prefab and SetParent to a canvas in current scene. (ep: obj.transform.SetParent(canvasGo.transform, false); ) In unity5.3, the "SetParent" operating was correnct, but update to unity2017 was not. The gamebject's anchors was not keep the same as prefab. In prefab, anchors settings is Min(0,0) and Max(1,1). In unity2017, anchors is Min(0,0) and Max(0,0) after "SetParent" operating, so gameobject position was incorrect. but in unity5.3 was keep the same as prefab. What happened about this in unity2017? Is it an error in unity2017?

Prefab中的设置 Unity5.3 操作后的Inspector Unity2017 操作后的Inspector

0

There are 0 answers