I have a Character class with a ragdoll and a HumanoidCharacter subclass that should set it.
public class Character : MonoBehaviour {
private Ragdoll ragdoll;
public Character(Ragdoll ragdoll, int maxInventorySize) {
if (ragdoll == null) throw new System.ArgumentNullException("ragdoll");
this.ragdoll = ragdoll;
}
}
public class HumanoidCharacter : Character {
public HumanoidCharacter(int maxInventorySize) : base(new Ragdoll(new ItemSlot[] {new ItemSlot(ItemSlotType.RightHand)}), maxInventorySize) {
}
}
public class PlayerCharacter : HumanoidCharacter {
public PlayerCharacter() : base(32) {
}
}
I’m getting the ArgumentNullException for ragdoll when I attach PlayerCharacter to a GameObject.
I would have thought that PlayerCharacter’s constructor is called, which calls HumanoidCharacter’s sonstructor which then calls Character’s constructor with the new Ragdoll. What’s going wrong?