UIのPrefabを追加するときのWarning

Prefab化したUIパーツをCanvasに、スクリプトでアタッチしようとしたらWarningが出た。

Parent of RectTransform is being set with parent property. Consider using the SetParent method instead, with the worldPositionStays argument set to false. This will retain local orientation and scale rather than world orientation and scale, which can prevent common UI scaling issues.
UnityEngine.Transform:set_parent(Transform)

GameObject o = Instantiate( Foo );
o.transform.parent = this.transform;

こういう様に親GameObjectを指定するのは良くはなく、以下が正しい。

GameObject o = Instantiate( Foo );
o.transform.SetParent(this.transform);

Via! http://haraken.hatenablog.com/entry/2016/11/11/RectTransform%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%82%BF%E3%83%B3%E3%82%B9%E3%81%A8%E3%82%B5%E3%82%A4%E3%82%BA%E3%81%AE%E8%A9%B1