Skip to content

Unity Plugin - Event threading

On Android, the native SDK reports ad events outside Unity's main thread; on iOS they arrive on the main thread. The plugin either raises each event right away, or queues it and raises it on Unity's main thread in the next frame. InvokeEventsOnUnityMainThread controls which:

A11MediationSDK.InvokeEventsOnUnityMainThread = null; // default
  • null (default) - lifecycle events (loaded, shown, closed, etc.) are queued to Unity's main thread, and revenue events fire right away. Recommended for most apps.
  • true - every event is queued to Unity's main thread, including revenue events.
  • false - every event fires right away.

Caution

With null or false, handlers that fire right away run outside Unity's main thread on Android. Don't call Unity APIs from them, and keep them thread-safe. A revenue event can also arrive before the matching On*Shown event.

Caution

Avoid true if you track impression-level revenue. Unity's main thread is paused while a full-screen ad is showing, so queued revenue events only arrive once the user returns to your game, and never if they don't. Your revenue reporting will then be delayed or incomplete.