[Unity] API learning --> common methods of GameObject objects
Enterprise
2023-08-06 15:01:51
views: null
static property
Attributes |
effect |
name |
name |
activeInHierarchy |
is active in the scene |
activeSelf |
Whether the component is active |
isStatic |
Is it a static object |
layer |
level |
scene |
Scene |
tag |
Label |
transform |
position, rotation, deformation properties |
common method
method |
incoming parameters |
effect |
AddComponent (string className ) |
component name |
Add a className component called |
CompareTag(string tag) |
tag name |
Check if this tag exists in this object |
GetComponent |
generic |
Gets a reference to the component of type T on the specified GameObject Returns null if not |
GetComponentChildren |
generic |
Gets a reference to the component of type T on any child of the specified GameObject returns null if none |
GetComponentInParent |
generic |
Gets a reference to the component of type T on any parent of the specified GameObject returns null if none |
GetComponents |
generic |
Gets a reference to all components of type T on the specified GameObject Returns null if none |
GetComponentsChildren |
generic |
Gets a reference to all components of type T on any child of the specified GameObject Returns null if none |
GetComponentsInParent |
generic |
Gets references to all components of type T on any parent of the specified GameObject Returns null if none |
SetActive |
Bool |
Choose whether to activate the GameObject according to the assignment (True or False) |
Find |
GameObject name |
find this object |
FindWithTag |
Label |
Find objects based on tags, return the first object found |
Destroy |
game object |
destroy this game object |
DontDestroyOnLoad |
game object |
Do not destroy this object when creating a new scene |
FindGameObjectsWithTag |
Label |
Find all objects by tag |
Origin blog.csdn.net/ainklg/article/details/129768049