GetGameObjectByTag
描述
通过标签找到游戏对象
参数
| Param | Type | 描述 |
|---|---|---|
| _tag | String | 独一无二的名称 |
| _gameObject | GameObject(out) | 搜索结果 |
方法
警告
你必须将GameObjectRuntimeTag脚本添加到你将用于检索的gameObject中,并在GameObjectRuntimeTag.RuntimeTag字段中输入Tag。
public void GetGameObjectByTag(string _tag,GameObject _gameObject)
例子
private void OnLoad(){
RuntimeTagManager.GetRuntimeTagManager.GetGameObjectByTag("Player",out GameObject tmp_Player);
if(tmp_Player.GetComponent<IRuntimeTag>().DoCompareTag("Player")){
Debug.Log(tmp_Player.name);
}
}