1
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?

More than 3 years have passed since last update.

Unity初心者 変数定義の豆知識

Last updated at Posted at 2021-11-18

3つのfloatをメンバで自動的にVector3にする方法

<スクリプト側>

    public float x, y, z;
    Vector3 moveXYZ {
        get => new Vector3(x, y, z);
        set => new Vector3(x, y, z);
        }


image.png

これで、Editor側で数字を入れるとVector3を作成してくれました!

アクセス修飾子 (よく出てくるものだけ)

static系 private [SerializeField] private public
inspectorには表示できない 同一スクリプト内でしか参照できない 外部から参照できないがinspectorで入力できる 外部からの参照もできるしinspectorでも入力できる
1
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
1
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?