Quick answer: Wrap with Variant.From(value). Or use Callable.From(lambda).CallDeferred() for type-safe args.
CallDeferred("ApplyDamage", customStruct). Type mismatch error. Variant doesn’t know how to pack the struct.
The Fix
// Lambda capture (preferred, type-safe)
Callable.From(() => ApplyDamage(customStruct)).CallDeferred();
// Or with Variant.From
CallDeferred(MethodName.ApplyDamage, Variant.From(customStruct));
// Or check if registered as Variant-compatible
[GlobalClass]
public partial class DamageInfo : RefCounted {
public int Amount;
}
Lambdas are usually cleanest. Variant.From explicitly converts to the engine type system. RefCounted/Resource types pack natively.
Verifying
Deferred call lands on next idle frame. Args delivered correctly. Without wrap: type mismatch error.
“Lambda or Variant.From. Deferred lands.”
Related Issues
For C# disposed after await, see disposed. For C# Collections.Array, see Collections.Array.
Lambda. Variant.From. Args land.