Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created June 13, 2018 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todorok1/832d5b0728b36e770e4542793ba0ac32 to your computer and use it in GitHub Desktop.
Save todorok1/832d5b0728b36e770e4542793ba0ac32 to your computer and use it in GitHub Desktop.
SerializeFieldとNonSerializedの頂上バトル
// privateに[SerializeField]をつけて表示させる
[SerializeField]
int hp;
// privateに[SerializeField]をつけない(表示されない)
int mp;
// privateに[SerializeField]と[System.NonSerialized]の両方をつける
[SerializeField][System.NonSerialized]
int atk;
// privateに[SerializeField]と[System.NonSerialized]の両方をつける(上とは逆の順番)
[System.NonSerialized][SerializeField]
int def;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment