Skip to main content

GetGameObjectByTag

Description

Finding the gameObject by tag

Parameters

ParamTypeDescription
_tagStringUnique name
_gameObjectGameObject(out)The search result

Method

caution

You must add the GameObjectRuntimeTag script to the gameObject you will use for retrieval and enter Tag into the GameObjectRuntimeTag.RuntimeTag field.

public void GetGameObjectByTag(string _tag,GameObject _gameObject)

Example

private void OnLoad(){
RuntimeTagManager.GetRuntimeTagManager.GetGameObjectByTag("Player",out GameObject tmp_Player);
if(tmp_Player.GetComponent<IRuntimeTag>().DoCompareTag("Player")){
Debug.Log(tmp_Player.name);
}
}