Skip to content

Compatibility, IL2CPP Patterns, and Troubleshooting

  • CoroutinesMelonCoroutines.Start(enumerator) (not StartCoroutine); the Anomaly Coroutines helper.
  • Cross-scene stateUnityEngine.Object.DontDestroyOnLoad(go) on survivors.
  • Custom MonoBehaviours[RegisterTypeInIl2Cpp] plus the two-constructor pattern ((IntPtr) + parameterless).
  • Managed collections on a registered MonoBehaviour[HideFromIl2Cpp] on any method that touches Dictionary/List/etc.
  • IL2CPP-event delegatesDelegateSupport.ConvertDelegate<T> when binding managed handlers to IL2CPP events (see ClientRuntime.Initialize / ShotEventManager.OnShot).
  • Common footguns — missing MelonAdditionalDependencies("Anomaly"), subscribing to one-shot events too late (no replay), touching LocalPlayer before ClientEvents.Ready.
  • Reading stack traces that cross managed + IL2CPP boundaries.
  • E:\Projects\AnomalyLabs\Anomaly\Anomaly.Client.Api\MODDING.md — “IL2CPP gotchas” and “Lifecycle”.
  • Anomaly.Client\Runtime\ClientRuntime.cs — reference pattern for IL2CPP delegate conversion.