不确定这是Unity3d / NGUI问题的最佳论坛,但试一试......
我试图通过重新创建将游戏对象从可滚动面板移动到普通面板。
firstGameObject.transform.parent = secondGameObject.transform;firstGameObject最初是剪切的可滚动面板的子代。 转换似乎在层次结构中移动得很好,不再可以滚动。 但它仍然被裁剪成像裁剪面板的孩子一样。
有任何想法吗?
编辑:NGUI论坛的某人建议在两个uipanel上调用Refresh(),但它没有效果。 http://www.tasharen.com/forum/index.php?topic=1941.0
Not sure this is the best forum for Unity3d/NGUI questions but give it a try...
I am trying to move a gameobject from a scrollable panel to a normal panel by reparenting it.
firstGameObject.transform.parent = secondGameObject.transform;firstGameObject is initially child of a clipped scrollable panel. The transform seems to move just fine in the hierarchy and no longer becoming scrollable. But it is still clipped like it was a child of the clipped panel.
Any ideas?
Edit: Someone at NGUI's forum suggested calling Refresh() on both uipanels, but it had no effect. http://www.tasharen.com/forum/index.php?topic=1941.0
最满意答案
终于搞定了。 正确的方法是在重新显示后在旧面板中的每个窗口小部件上调用CheckParent()。
UIPanel smallPanel = NGUITools.FindInParents<UIPanel>(firstGameObject); List<UIWidget> list = new List<UIWidget>(smallPanel.widgets.buffer); foreach (UIWidget widget in list) { if (widget != null) { widget.CheckParent(); } }Finally got it working. The correct way was to call CheckParent() on each widget in the old panel after reparenting.
UIPanel smallPanel = NGUITools.FindInParents<UIPanel>(firstGameObject); List<UIWidget> list = new List<UIWidget>(smallPanel.widgets.buffer); foreach (UIWidget widget in list) { if (widget != null) { widget.CheckParent(); } }更多推荐
发布评论