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 all close all

Basic Examples  (4)

Load the UnityLink:

In[1]:=
Click for copyable input

Open a Unity project:

In[2]:=
Click for copyable input

Find the ball game object:

In[1]:=
Click for copyable input
Out[1]=

Find the game object's rigidbody component:

In[2]:=
Click for copyable input
Out[2]=

Find the transform component on the ball game object:

In[1]:=
Click for copyable input
Out[1]=

Find all components on the ball game object:

In[1]:=
Click for copyable input
Out[1]//Short=

Scope  (7)

Options  (3)