Hi, now in Fighter we don’t check if defaultWeapon is null,
so if we forget to reference it in the inspector we, of course, have this “null reference” we all hate (I think).
I tried to had this simple “if statement” in Awake():
private void Awake()
{
if (defaultWeapon == null)
{
defaultWeapon = UnityEngine.Resources.Load<Weapon>("Unarmed");
}
currentWeapon = new LazyValue<Weapon>(SetupDefaultWeapon);
}
It works fine, I just wonder if it isn’t a bad thing to call Resources in Awake()?
M. D.