- Home /
Question by
lsp34 · Apr 02, 2020 at 02:14 PM ·
scripting beginnervariablesscriptableobjectconstant
Do i need to create a "current value" for those private variables?
I'm planning to make those private variables to constant. Any approach in accessing const outside the class. Thanks in advance.
public class PlayerData : ScriptableObject
{
[SerializeField] private new string name;
[SerializeField] private int health = 10;
[SerializeField] private int damage = 1;
[SerializeField] private int xp = 0;
[SerializeField, Range(1, 100)] private int level = 1;
public int Damage { get => damage; set => damage = value; }
public string Name { get => name; set => name = value; }
public int Xp { get => xp; set => xp = value; }
public int Level { get => level; set => level = value; }
public int Health { get => health; set => health = value; }
}
Comment