C#: required rules and project style
What generators and persistence require, and what the team can choose.
Rules that affect behavior
| Rule | Reason |
|---|---|
| partial on a ReckfellObject-derived class | Generators add API code; missing partial produces RF0001 |
| Attached class/file names match, including case | Generators associate the script with its path |
| Export only supported instance members | Static/readonly/unsupported members do not become stored state |
| Signal delegates end in EventHandler | Generators create the event; see the signals guide |
| Stable exported names and paths | Serialized data and level dependencies use them |
Renaming an exported member does not migrate stored values. Before a bulk rename, inspect affected .rscene/.rprefab/.rdata files and old-data loading. Do not edit generated MethodName/PropertyName: change the source member and rebuild.
Readable project conventions
These examples use PascalCase for types, methods and properties, _camelCase for private fields and camelCase for locals. This is a convention rather than a separate engine architecture. Do not rename required callbacks such as _Ready to follow ordinary-method conventions.
Name quantities by their meaning: delta is callback time, Damage is damage, Ammo is a count. Place refusal checks before mutation; TryFire consumes no ammo when settings are invalid.
ExportedWeapon.cs
using Reckfell;
public partial class ExportedWeapon : Entity
{
[Signal] public delegate void FiredEventHandler(int damage);
[Export] public ShotSettings? Settings { get; set; }
[Export(PropertyHint.Range, "0,99,1")] private int _ammo = 5;
public int Ammo => _ammo;
public int TransientValue { get; set; } = 3;
public bool TryFire()
{
if (_ammo <= 0 || !ReckfellObject.IsInstanceValid(Settings) ||
!Settings!.TryGetDamage(out int damage)) return false;
_ammo--;
EmitSignal(SignalName.Fired, damage);
return true;
}
}This component uses generated SignalName.Fired, separates per-instance state from Resource settings and returns bool for expected refusal. The export example provides the complete setup.
Do not add Entity, partial or GlobalClass to ordinary helpers such as InventoryLedger and VariantCounter just for uniformity. Establish formatting, using order and namespaces once for the project; this page does not override a team's existing conventions.