0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RectTransformとTransform.positionの違いについて

Posted at

RectTransformとTransform.positionの違いについて

RectTransformとTransform.positionの違いについての理解が曖昧で、特にUIの位置を決めるときによく問題が起きることがあったので、違いをまとめてみました。

RectTransformとは

RectTransformとはUI要素専用のコンポーネントで2D 空間におけるサイズと位置を制御します。
具体的にはスクリーン座標や相対的な座標を基に位置やサイズを管理します。

Transform.positionとは

Transform.positionは3D 空間でオブジェクトの位置を指定するために使用されます。
これは、全てのオブジェクト(3Dモデルやカメラなど)に関連付けられた通常の Transform コンポーネントで、Unityのワールド座標系(3D空間)でオブジェクトの位置を管理します。

まとめ

UIの位置を決める場合はRectTransform、3Dのオブジェクトの座標を決める場合はTransform.positionを使用しよう。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?