0

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

  • I try to change my prefab's canvas component "rendermode" setting to "World Space", it was solved. But i want to know the reason about it. – brendanwang Jul 19 '18 at 09:59
  • What happens when you pass true to SetParent? – Programmer Jul 19 '18 at 10:05
  • Pass true, my gameobject anchors, position and scale was all incorrect. – brendanwang Jul 19 '18 at 10:11
  • Since this issue happened after updating, I suggest you delete the old prefab, create a new one under the canvas and position it where it should be then use that new prefab. It's likely that the old one is corrupted due to a bug. – Programmer Jul 19 '18 at 10:18

0 Answers0