Skip to content

[iOS] Runtime Crash when Unity Sends Message to Flutter #65

@karam89

Description

@karam89

Is there an existing issue for this?

  • I have searched the existing issues

Unity version

Unity 6000.0 LTS

Common issues

  • I have checked the common issues

Flutter version

3.29.3

Description

Summary

Unity crashes on iOS (TestFlight) at runtime when calling SendToFlutter.Send(...) during scene initialization (e.g. Start).
The crash happens after navigating to the Flutter tab that contains the Unity view.

Even if the call is delayed for few seconds it crashes at the time of the call, but if we cancel the call of SendToFlutter.Send it doesn't crash.

This does not occur on Android.

Environment

Flutter: 3.29.3
Unity: 6000.0.64f1
Architecture: ARM64
flutter_embed_unity: 1.4.0
Xcode: 26.2
Device: physical iPhone (not simulator)

What happens

  • App launches normally
  • Unity view is embedded successfully
  • When navigating to the tab containing Unity:
  • Unity scene loads
  • Unity sends a message to Flutter using SendToFlutter.Send("init")
  • App crashes immediately
  • The crash does not happen at startup, only when the Unity view becomes active.

Expected behavior

Unity should be able to communicate with Flutter after the Unity view is shown, without crashing the app.

Actual behavior

The app crashes with a native iOS exception inside UnityFramework.

Important findings

  • Delaying the call with Invoke, coroutine, or WaitForSeconds does NOT fix the crash
  • The crash only occurs on iOS (TestFlight)
  • Android works fine
  • The issue appears to be caused by Unity initiating communication before Flutter’s MethodChannel is ready

Checks

  • Made sure Other Linker Flags are present
Image

Crash log (on xcode)

Image

Crash log files (.crash)

crashlog_2.txt
crashlog_1.txt

Minimum reproducible example (MRE)

No response

What platforms are you seeing the problem on?

iOS

Devices

iPhone devices

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions