static public void SetActive (GameObject go, bool state)
{
if (state)
{
Activate(gotransform);
}
else
{
Deactivate(gotransform);
}
}
然后Activae(Transform t)是这样定义的:
static void Activate (Transform t)
{
SetActiveSelf(tgameObject, true);
// Prior to Unity 4, active state was not nested It was possible to have an enabled child of a disabled object
// Unity 4 onwards made it so that the state is nested, and a disabled parent results in a disabled child
#if UNITY_3_5
for (int i = 0, imax = tGetChildCount(); i < imax; ++i)
{
Transform child = tGetChild(i);
Activate(child);
}
#else
// If there is even a single enabled child, then we're using a Unity 40-based nested active state scheme
for (int i = 0, imax = tchildCount; i < imax; ++i)
{
Transform child = tGetChild(i);
if (childgameObjectactiveSelf) return;
}
// If this point is reached, then all the children are disabled, so we must be using a Unity 35-based active state scheme
for (int i = 0, imax = tchildCount; i < imax; ++i)
{
Transform child = tGetChild(i);
Activate(child);
}
#endif
}
SetActiveSelf(tgameObject, true);方法是这样定义的:
static public void SetActiveSelf(GameObject go, bool state)
{
#if UNITY_3_5
goactive = state;
#else
goSetActive(state);
#endif
}
结论就是他的这个NGUIToolsSetActive(gameObject, false);方法归根结底还是用的gameObjectsetActivate(bool state)方法,所以你还是直接用gameObjectsetActivate(bool state)方法就可以了首先,将下载好的NGUI插件导入的相应的项目中。
打开NGUI菜单,Open->Atlas Maker。这个菜单可以让我们快速的创建一个游戏中的图集。
在该菜单打开后,只需要在文件下选择需要添加的入图集的便可自动加入到图集项目中,多张可以使用Ctrl或shift来选择。
4
点击create或add来创建或添加图集。下面便是我们的创建的图集文件。NGUI实现的ScrollView中的控件中可以拖动里面的子物体!但是这些子物体是不带吸附作用的!比如说:现在有3张放在scrollView下,我拖动一下可能停在两张半的地方!我想要停在1张,2张 ,或者第3张的位置
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)