Skip to content

Commit b11ea17

Browse files
bezoroxsduan
authored andcommitted
Fix warning about setting RectTransform's parent
Unity complains about setting a GameObject's parent directly if the GO has a RectTransform instead of normal Transform. Using SetParent() the warning is gone while keeping the behaviour the same.
1 parent 8be1293 commit b11ea17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Runtime/Folder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void Flatten()
192192
if (child.parent == this.transform)
193193
{
194194
child.name = $"{this.name}/{child.name}";
195-
child.parent = this.transform.parent;
195+
child.SetParent(this.transform.parent, true);
196196
child.SetSiblingIndex(++index);
197197
}
198198
}

0 commit comments

Comments
 (0)