将UI图像放入网格布局组Unity C# [英] Put UI image to Grid Layout Group Unity C#

查看:477
本文介绍了将UI图像放入网格布局组Unity C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这会发生什么。请检查下面的链接。


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


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


无论我做了什么,都会更改网格布局组组件:单元格大小值,间距。它以与上面的url pic相同的结果结束,图像gameobject在左侧切割。图像gameobject的大小没有修复网格布局组的内容。



当我尝试滚动它时,它以相同的结果结束。



有什么想法吗?



谢谢 p>我自己找到了解决方案, 阅读此文: http://docs.unity3d.com/ScriptReference/Transform.SetParent.html



示例:

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

它解决了问题

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

解决方案

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

这篇关于将UI图像放入网格布局组Unity C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆