public static variable access returning null from others

I’m building an RPG game.

I have a public static PlayerData class that controls strength, rightHandSlot, inventory, etc. It is not attached to anything and does not inherit from anything.

I have inventory and equipment working fine in that from my MainGUI I can call and use the rightHandSlot like this:

void Start () {
		PlayerData.rightHandSlot = new InventorySlot(WeaponDatabase.PabDagger, 1);
		Debug.Log (PlayerData.rightHandSlot._item._name);
	}

this successfully logs the daggers name for me no problem, and I use the slots elsewhere etc.

My problem comes in with my skills:

    public class GeneralSkills {
    
    	public static Skill _meleeAttack = new Skill(
    		"Attack", "Melee attack",
    		Classes.currentClass.Civilian, 1, 1, 1,
    		SkillCategory.General, SkillType.Melee, SkillUse.Action, SkillTarget.Mob, 1f,
    		new Buff[]{
    			new Buff(
    				new Damage(PlayerData.GetMeleeDamageType(), PlayerData.GetMeleeDamage(), 0)
    			) 
        	}, PlayerData.baseMeleeSpeed);
    }

this is just a database class that I want to continually add my skills into, this being the just basic melee attack. the normal ints and enums and all work fine, but calling stuff from the PlayerData class doesn’t seem to be working from here. This script is not using monobehavior and is not attached to anything, I’m just calling it generally. The GetMeleeDamage() looks like this:

public static int GetMeleeDamage () {
		if (PlayerData.rightHandSlot != null) {
			Weapon curWep = (Weapon)PlayerData.rightHandSlot._item;
			return Random.Range((PlayerData.baseMeleeDamage - PlayerData.baseMeleeDamageVariance) + (curWep._damage1 - curWep._damage1Variance),
			                    (PlayerData.baseMeleeDamage + PlayerData.baseMeleeDamageVariance) + (curWep._damage1 + curWep._damage1Variance) + 1);
		}
		else {
			return Random.Range(PlayerData.baseMeleeDamage - PlayerData.baseMeleeDamageVariance, PlayerData.baseMeleeDamage + PlayerData.baseMeleeDamageVariance + 1);
		}
	}

which if I look at before I I equip something, then again after, it returns the damage properly. But when I go to use my attack skill it always reads the rightHandSlot as empty, and so always only returns the default damage, never considering the weapon damage.

To summarize, the function and the variables in question are all stored on the PlayerData
script. But trying to access them from the global non-object-oriented GeneralSkills class the public static PlayerData.GetMeleeDamage() function always considers public static PlayerData.rightHandSlot as null even though other scripts and PlayerData itself are well aware that it is not null and actually contains the dagger.

I dun get it XD

Thank you for any input.

well I made this:

public class SkillTestStrike : ISkillTest {

	public SkillTestStrike () {

	}

	public void UseSkill (GameObject mob) {
		mob.GetComponent<MobAi>().TakeDamage(PlayerData.GetMeleeDamage(), PlayerData.GetMeleeDamageType());
	}

}

and called it like this:

SkillTestStrike newS = new SkillTestStrike();

void Start () {
     if (Input.GetKeyDown(KeyCode.Alpha3)) { newS.UseSkill(PlayerData.player.GetComponent<PlayerScript>().target); }
}

and it’s properly changing depending on whether my weapon is equipped or not…
I don’t understand why the class in the OP won’t do the same thing, but at least I found a way to do it…