- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
 
- 纳金币
- -1
- 精华
- 11
|
Some info
This script is useful when you have a complex object with lots of child objects and you want selectively
activate/deactivate them. With this script you will be able add some objects in logical groups.
Method list
•AddObjects(string id, GameObject obj0.....6)
id is a name of your group
obj0....6 - Adds up to 6 objects in logical group
•manualAddObjects(string id, List<GameObject> obj)
If you need more than 6 objects in group make a generic list of gameobjects first
•ClearAll()
Clears all groups
•ClearTable(string id)
Clears selected group
•OverrideTable(string id,List<GameObject> obj)
Override selected group with other generic list
•ActivateObject(string id)
Activate selected group
•DeactivateObject(string id)
Deactivate selected group
Step by Step tutorial
1. Add script in your project and call it objUtility.cs
2. In the beggining of script where you want to use objUtility write
"using System.Collections.Generic;" (optional )
3. Add objUtility variable to your code
objUtility objUtil; (example)
4. initialize it, for example in Start()
objUtil = new objUtility();
5. Add game objects to it.
objUtil.AddObjects("head",eyes,face,nose);
6. As an example, deactivate "head" group of objects
objUtil.DeactivateObject("head");
Download objUtility
objUtility.cs
PS
I dont know if it works with JS scripts. Ill improve this script and maybe make an editor for it to make object groups via interface if you find it useful. |
|