Skip to content

Conversation

@timbotimbo
Copy link
Collaborator

This PR is mainly intended to fix #51, but also includes some additional cleanup.

The error in #51 is caused by platform specific iOS code that doesn't work in the Play mode of the Unity Editor.
This can easily be fixed by checking for NOT editor.

-#if UNITY_IOS
+#if UNITY_IOS && !UNITY_EDITOR
            // Call an obj-C function name
            FlutterEmbedUnityIos_sendToFlutter(data);
#endif

While updating this, I noticed Android uses a runtime check instead of compile-time.
So I combined both checks into #if and #elif logic.

In short:

  • Fixes #if UNITY_IOS check by checking for UNITY_EDITOR first.
  • Replace Application.platform == RuntimePlatform.Android with #if UNITY_ANDROID for efficiency.
  • Debug.Log when SendToFlutter.Send() is called in the Unity Editor, to show the function does something.

The changes are identical for Unity 2022_3 and 6000_0

@timbotimbo timbotimbo added the bug Something isn't working label Aug 4, 2025
@timbotimbo timbotimbo requested a review from jamesncl August 4, 2025 09:09
Copy link
Collaborator

@jamesncl jamesncl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@jamesncl jamesncl merged commit 2220b8f into learntoflutter:main Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] EntryPointNotFoundException in SendToFlutter in Unity Editor play mode.

2 participants