UnityLink`
UnityLink`

FindUnityComponent

FindUnityComponent[obj,"type"]

finds the component on the game object obj and type "type".

FindUnityComponent["name",]

finds the component on the game object with name "name".

FindUnityComponent[patt, ]

finds the component on the game object with name matching the string pattern patt.

FindUnityComponent[,n]

finds at most n components.

Details

  • FindUnityComponent returns the first Unity game object component it found, Missing["Nonexistent"] if none were found.
  • The following option can be specified:
  • Method"Self"search bounds in the transform hierarchy
  • Possible Method settings include:
  • "Self"searches only the game object
    "Ancestors"searches the game object and its ancestors
    "Descendants"searches the game object and its descendants
  • FindUnityComponent[,n] returns a list of at most n components.
  • FindUnityComponent[,All] finds all matching components.
  • FindUnityComponent[All] finds all components in the open scenes.

Examples

open allclose all

Basic Examples  (4)

Load the UnityLink:

Open a Unity project:

Find the ball game object:

Find the game object's rigidbody component:

Find the transform component on the ball game object:

Find all components on the ball game object:

Scope  (7)

Find a component from a UnityGameObject reference:

Find a component from the name of the game object:

Find the first three components on a game object:

Find all the components on a game object:

Find all the components of a certain type:

Find components using string patterns:

Find components using abbreviated string patterns:

Options  (3)

Method  (3)

Find the transform component on a single game object:

Find all transform components on a game object and its descendants:

Find all transform components on a game object and its ancestors:

Wolfram Research (2019), FindUnityComponent, Wolfram Language function, https://reference.wolfram.com/language/UnityLink/ref/FindUnityComponent.html.

Text

Wolfram Research (2019), FindUnityComponent, Wolfram Language function, https://reference.wolfram.com/language/UnityLink/ref/FindUnityComponent.html.

CMS

Wolfram Language. 2019. "FindUnityComponent." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/UnityLink/ref/FindUnityComponent.html.

APA

Wolfram Language. (2019). FindUnityComponent. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/UnityLink/ref/FindUnityComponent.html

BibTeX

@misc{reference.wolfram_2022_findunitycomponent, author="Wolfram Research", title="{FindUnityComponent}", year="2019", howpublished="\url{https://reference.wolfram.com/language/UnityLink/ref/FindUnityComponent.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2022_findunitycomponent, organization={Wolfram Research}, title={FindUnityComponent}, year={2019}, url={https://reference.wolfram.com/language/UnityLink/ref/FindUnityComponent.html}, note=[Accessed: 22-December-2024 ]}