Unity NGUI 代码获取Cell Width
在Unity NGUI中获取Cell的宽度,可以通过以下代码实现:
// 获取Grid组件
UIGrid grid = GetComponent<UIGrid>();
// 获取Cell的宽度
float cellWidth = grid.cellWidth;
其中,GetComponent<UIGrid>()方法可以获取当前GameObject上的UIGrid组件,而grid.cellWidth可以获取UIGrid中设置的Cell宽度。
原文地址: https://www.cveoy.top/t/topic/gA3w 著作权归作者所有。请勿转载和采集!