Hello!
I have a generic data wrapping class called Combat:
public Class Combat{
public float damage;
public float maxHealth;
public float movement;
//other stuff
}
I have several different types of units (for example Infantry, Tank) that I want to have static Combat members:
public Class Infantry{
public static Combat combat;
//other stuff
}
I want to organize it this way because all Infantry share damage, maxHealth, movement, etc, and I want to wrap all of that common behaviour rather than listing lots of static floats and bools for every class.
As I’ve currently written it, I get a null reference exception when I try to access Infantry.combat. For example, in the Infantry Start() method if I just try print(Infantry.combat.damage) it throws a null reference.
Anyone know what I need to do to get this data wrapping static class to work?
Thanks in advance!