unity3D ngui 插件 关于隐藏和显示游戏对象的问题

unity3D ngui 插件 关于隐藏和显示游戏对象的问题,第1张

我看了下NGUI关于 NGUIToolsSetActive(gameobject,state)这个方法的定义,是这样定义的

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)方法就可以了

很简单的啊 public UILabel text; 声明,然后脚本给一个物体,直接把label拖上去,然后引用的 时候直接使用texttext = "中文"; 这是label。 至于button你想问的是按钮的事件吗? 添加脚本buttonmessage,然后把写有事件的脚本拖给target,下面

这种情况出现的问题可能有很多种,不过电脑测试正常导手机后出错的问题一般都是出在资源路经上,因为导出手机apk后最容易出问题的地方就是路经问题,你的lable不可能是程序运行时再输入文字,那么应该是导入的文件内的文本,那十有八九是路经问题,手机上的路径跟电脑上的有点不同,运行时找不到读取文字的文件,便不显示文字了

C#调用JS。。这个已经无关unity了,从语言的角度来想了。

两门语言之间相互调用变量,方法,这是不可能的。。。

语言间的交互,也就只能通过一些字符串,XML,文本之类的通用数据

以上就是关于unity3D ngui 插件 关于隐藏和显示游戏对象的问题全部的内容,包括:unity3D ngui 插件 关于隐藏和显示游戏对象的问题、如何利用ngui制作一个toggle、unity ngui中lable上的文字显示问题,求帮忙等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/10130810.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存