LoginSignup
0
0

忘備録 Unity コンポーネントの値の取得方法

Last updated at Posted at 2024-04-01

Inspectorでアタッチされているコンポーネントを確認し、そこにあるコンポーネントの何を取得したいのかを確認する

例えばTransformコンポーネントのpositionの値を取得したい場合

public Transform TransformValue;
Vector3 positionValue = TransformValue.position;

GetComponentメソッドを使った方法

public Transform TransFormValue;
positionValue = GetComponent();

上記の2つの方法がやりやすそう

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0