Unity3d_iGUI_多个Root的使用

在unity3d中,如果你是使用的IGUI的话,那么当我们做一个GUI系统的时候,我们就会在iGUICode_xx.cs文件中进行有关的代码编写。但是一旦我的GUI系统十分复杂的时候就会出现让我们“疯狂”事情了,代码好庞大。

所以我们就需要对代码进行分离,把GUI系统划分一下。这个时候我们就希望在不同脚本中编辑相应的代码,这样下来我们的代码就没有那么复杂了。

在iGUI插件的之前版本是没有这样的功能的,那样我们就需要很特殊的处理了。现在都不想回忆那种繁琐的快感了!

在IGUI的最新版中就给我们提供这样的功能,现在介绍如下:

Multiple Roots

Attention : Multiple roots are in beta stage and only available after iGUI 1.2.4 and iGUIBasic 1.0.1

To create multiple roots follow these steps :

1) Create a scene.
2) Add a root.
3) Duplicate the root from hierarchy tab
4) Duplicate iGUICode_sceneName file
5) Change the file name to iGUICode_sceneName2 for example. Also change the class declaration, instance type and getInstance() return type to iGUICode_sceneName2.
6) Now drop the edited script file (iGUICode_sceneName2) to the “Manual code file” property of new root.

Now you’re ready to go. To edit gui elements, you have to enable only one root at a time and disable the ones which won’t be edited. You can enable/disable roots using the component checkbox (Please take a look at the figure right).

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
结束语:
        Enjoy!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值