查看: 1469|回复: 0
打印 上一主题 下一主题

ObjUtility,批量物体控制脚本

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-2-21 14:55:45 |只看该作者 |倒序浏览
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

&bull;manualAddObjects(string id, List<GameObject> obj)

If you need more than 6 objects in group make a generic list of gameobjects first

&bull;ClearAll()

Clears all groups

&bull;ClearTable(string id)

Clears selected group

&bull;OverrideTable(string id,List<GameObject> obj)

Override selected group with other generic list

&bull;ActivateObject(string id)

Activate selected group

&bull;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.
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-2-24 20:46 , Processed in 0.073446 second(s), 32 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部