A class is a blueprint; an object is an instance of that class.
public class Weapon
{
public string name;
public int damage;
public Weapon(string name, int damage)
{
this.name = name;
this.damage = damage;
}
public void Attack()
{
Debug.Log($"{name} deals {damage} damage");
}
}
Weapon sword = new Weapon("Sword", 25);
Unity components usually inherit from MonoBehaviour and are created by Unity rather than with new.