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 5 years have passed since last update.

staticな変数にはUnityのAttribute(属性)が効かないっぽい

Last updated at Posted at 2018-03-19

Unity初心者の備忘録
タイトルのまんまで単純なことなのですが、検索ででてこなくて半日潰したのでメモっておきます。

例えば、これだとダメで

[Range(0, 5)]
public static int Hoge;

これならいけます。

[Range(0, 5)]
public int Hoge;

[SerializeField]とかも当然効かないです。

getter、setterを設定するのが面倒だったのでstaticにしたのですが、まさかこんな落とし穴があるとは…。
次からはちゃんと{get; set;}くらいは書こうと思います。

1
0
2

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?