Dennis Liu
Dennis Liu

Reputation: 303

Put UI image to Grid Layout Group Unity C#

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

Upvotes: 2

Views: 2537

Answers (1)

Dennis Liu
Dennis Liu

Reputation: 303

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

Upvotes: 2

Related Questions