I noticed that while moving in between scenes, the weapon resets to the default weapon. I thought it was an easy fix, so I tried implementing it myself
public object CaptureState()
{
return currentWeapon;
}
public void RestoreState(object state)
{
currentWeapon = (Weapon)state;
}
However, this causes an error to return: “SerializationException: Type ‘RPG.Combat.Weapon’ in Assembly ‘Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ is not marked as serializable”.
To be honest, I don’t really understand what this means. But I attempt to explicitly mark the “currentWeapon” variable as serializable, but that didn’t help. Am I going about this the wrong way? Or am I missing something obvious?