找回密码
 注册帐号

扫一扫,访问微社区

component.comparetag 比较标签

2015-1-5 03:47| 发布者: 杨炎| 查看: 3096| 评论: 0|原作者: 蛮牛|来自: unity3d脚本manual

摘要: component.comparetag 比较标签functioncomparetag(tag: string) : booldescription描述is this game object tagged tag?游戏物体有被标记标签么?c#javascriptusing unityengine;using system.collections;public c ...

component.comparetag 比较标签

functioncomparetag(tag: string) : bool

description描述

is this game object tagged tag?

游戏物体有被标记标签么?

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

void ontriggerenter(collider other) {

if (other.comparetag("player"))

destroy(other.gameobject);

}

}

// immediate death trigger.

//立即死亡触发

// destroys any colliders that enter the trigger, if they are tagged player.

//如果它们标签是player,进入这个触发器将销毁任何碰撞

function ontriggerenter (other : collider) {

if (other.comparetag ("player")) {

destroy (other.gameobject);

}

}

相关阅读

文章点评
相关文章