-
Notifications
You must be signed in to change notification settings - Fork 0
Common.Tag
DucNV_2000 edited this page Jul 10, 2024
·
1 revision
-
FindComponentInChildWithTagFind component by tag
T FindComponentInChildWithTag<T>(this GameObject parent, string tag)Example
public GameObject player;
private BoxCollider _boxCollider;
public void GetBoxColliderPlayer()
{
_boxCollider = player.FindComponentInChildWithTag<BoxCollider>("Player");
}-
SetLayerSet layer for this game object
GameObject SetLayer(this GameObject obj, int layerIndex)-
SetLayerForAllChildObjectSet layer for this game object and all child of game object
GameObject SetLayerForAllChildObject(this GameObject obj, int layerIndex)Example
public GameObject player;
public void SetLayerForAllChildPlayer()
{
player.SetLayerForAllChildObject(LayerMask.NameToLayer("Layer_Player"));
}-
SetTagSet tag for this game object
GameObject SetTag(this GameObject obj, string tag)-
SetTagForAllChildObjectSet tag for this game object and all child of game object
GameObject SetTagForAllChildObject(this GameObject obj, string tag)Example
public GameObject player;
public void SetTagForAllChildPlayer()
{
player.SetTagForAllChildObject("Tag_Player");
}