Are there such thing as header files in unity/C#?


There is no such thing as a header file in C#, but cs files can do what you need.

Size.cs

public enum Size {
    Small,
    Medium,
    Large
}

DamageAttributes.cs

public class DamageAttributes {
    // TODO: implementation
}

(I made these files separate to show that they can stand alone, without an associated owner class grouping them, and so it’s easy to find the file containing eg. Size – it’s the file with the same name! But of course you could lump these definitions together into one common file if you preferred)

You don’t need to manually include these files in your Sword and Spear class files. By default, anything public that you haven’t put into a specific namespace ends up in your default project assembly namespace, and can be referenced from any other file in your assembly without an extra using directive.

Of course, you could choose to place them inside a namespace if you’d like to do so for organization, like…

DamageAttributes.cs

namespace Weapons {
    public class DamageAttributes {
        // TODO: implementation
    }
}

Then you can reference the type with the qualified name Weapons.DamageAttributes or pull in the whole namespace (which might have its contents defined across multiple different source files) with a using Weapons; directive.