TryGetComponent
TryGetComponent<T>(GameObject, out T)
public static bool TryGetComponent<T>(this GameObject gameObject, out T outComponent) ;
説明
存在している場合にコンポーネントを取得する。
型パラメーター
| 型パラメーター名 | 説明 | 型制約 |
|---|---|---|
| T | コンポーネントの型 |
パラメーター
| パラメーター名 | 説明 |
|---|---|
| gameObject | GameObject |
| outComponent | 見つかったコンポーネントの出力引数 |
戻り値
コンポーネントが見つかった場合にtrueを返す。
TryGetComponent<T>(Component, out T)
public static bool TryGetComponent<T>(this Component component, out T outComponent) ;
説明
存在している場合にコンポーネントを取得する。
型パラメーター
| 型パラメーター名 | 説明 | 型制約 |
|---|---|---|
| T | コンポーネントの型 |
パラメーター
| パラメーター名 | 説明 |
|---|---|
| component | Component |
| outComponent | 見つかったコンポーネントの出力引数 |
戻り値
コンポーネントが見つかった場合にtrueを返す。