Quick answer: Godot 4 C# scripts trimmed out of AOT builds despite being attached to scenes? AOT trimmer doesn't know about scene-side references - mark as Preserve or use [GodotClassName].

AOT iOS build crashes on scene load; script type unresolved.

Mark Preserve

[DynamicallyAccessedMembers(
  DynamicallyAccessedMemberTypes.All)]
public class Enemy : Node {{}}

Trimmer reserves the type.

Or use linker XML

linker.xml with explicit preserve rules. More verbose; works for 3rd-party.

Validate on cooked builds

Each cooked build references all expected types. Missing = the trim bug.

“AOT trimming removes unreferenced code. Scene-only references aren't visible to trimmers.”

If your project ships AOT, the per-type Preserve audit is mandatory. Document; review.

Related reading