C#: names and types at API boundaries
Direct calls, MethodName/PropertyName, .NET arrays and exact C# declarations.
Start from the C# declaration
The reference displays declarations from the installed SDK. That declaration determines the name, types, argument order and return value. Dynamic invocation does not make arbitrary C# functions or unsupported data types engine-callable.
| Task | Rule |
|---|---|
| Invoke your C# method | boundary.Add(3) is an ordinary typed operation |
| Invoke through engine Call | Use ScriptBoundary.MethodName.Add and Variant-compatible arguments |
| Access through Get/Set | Use the corresponding PropertyName |
| Handle a packed numeric array | Follow the declaration, for example int[].Length |
| Use signal result data | Check its declaration and argument types, then EmitSignal/ToSignal |
ScriptBoundary.cs
using Reckfell;
public partial class ScriptBoundary : Entity
{
public int Count { get; private set; }
public bool Add(int amount)
{
if (amount <= 0 || Count > int.MaxValue - amount) return false;
Count += amount;
return true;
}
public bool ShowOnChild(string text)
{
Label? label = GetEntityOrNull<Label>("Status");
if (!ReckfellObject.IsInstanceValid(label)) return false;
label!.Text = text;
return true;
}
}The fixture calls Add(2), then Call(ScriptBoundary.MethodName.Add, 3), producing Count = 5. HasMethod("Add") is true; HasMethod("add") is false. Managed method names are case-sensitive. Built-in native string names may differ from C# names: use the owning class's cache rather than globally replacing snake_case with PascalCase inside strings.
Where model conversion is explicit
.NET and engine containers are not interchangeable merely because their names match. System.Collections.Generic.Dictionary is suitable for local calculation; Export and Variant require supported representations. InventoryLedger.Snapshot makes this boundary explicit.
Variant.Int holds a 64-bit integer even when its source C# type is int. Validate the range before narrowing input. C# structs such as Vector2 are values: assign a modified property copy back. See math for inverse transforms under scale.
If Call/Get/Set fails unexpectedly, check the build, attached script instance, name cache and actual VariantType. Prefer direct C# access when types are known so the compiler can catch mistakes before runtime.