Put UI image to Grid Layout Group Unity C#

与世无争的帅哥 提交于 2020-01-05 05:50:36

问题


I got trouble put the UI image inside Grid Layout Group in Unity.

This What happen. Check the link below.

  1. [IMG] http://i65.tinypic.com/fp2dly.jpg [/IMG]

  2. [IMG] http://i65.tinypic.com/2iudlxe.jpg [/IMG]

Whatever i have done change the Grid Layout Group Component : cell size value, spacing. It end with the same result like the url pic above with image gameobject cut at left side. The image gameobject size did not fix the content from the grid layout group.

When i try to scroll it, it end with same result.

Any idea ?

Thanks


回答1:


I found the solution myself,

Read this :

http://docs.unity3d.com/ScriptReference/Transform.SetParent.html

example :

childx.transform.SetParent (parentx.gameObject.transform,false);

it solve the problem



来源:https://stackoverflow.com/questions/38313413/put-ui-image-to-grid-layout-group-unity-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!