Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbol: _OnUnitySceneLoaded & Undefined symbol: _OnUnityMessage Error #574

Open
prakash-fermion opened this issue May 7, 2022 · 5 comments
Labels
Build This issue refers to the build configuration and builds failing. ios This issue is specific to the iOS/iPadOS Platform.

Comments

@prakash-fermion
Copy link

We were trying to integrate unity game using flutter plugin "flutter_unity_widget: ^4.2.1" & using unity framework version "Unity 2019.3.13f1" build is getting failed in iOS(Xcode). I've attached error screenshot for same issue. The same flutter plugin and configuration is working for android but only iOS end it is showing this issue.

Please anyone from the plugin development team look into this issue as we want to release this unity game in a week. For any doubt related to this issue description contact me at [email protected]

iOS_Ludo_issue

@jamesncl
Copy link

jamesncl commented May 27, 2022

In older versions of flutter_unity_widget, configuration steps to configure iOS might have changed from the current ones on pub.dev. Also, the unity packages that you have to import might be different.

I would checkout an old commit of flutter_unity_widget and follow the README.md file instead of the one on pub.dev, delete the Unity package you imported into your Unity project, and re-import the version from the older commit. Unfortunately the author isn't tagging releases, so it's difficult to figure out which commit matches a specific published version, but looking at the commit logs it looks like this commit is for version 4.2.0 which should be close enough: 2fbf1a592436a0fa3de514ebf0db3ca32a53f505

If this doesn't work, I suggest trying to upgrade everything so that you are using the latest version of the package, and using Unity 2022.1.0. As a last resort you could try doing something like this in XCode - select Unity-iPhone, then select PROJECT : Unity-iPhone, and in the Build Settings tab, configure the following

Build Options > Enable Bitcode No
Linking > Other Linker Flags -Wl,-U,_OnUnityMessage -Wl,-U,_OnUnitySceneLoaded

@jamesncl
Copy link

jamesncl commented Jul 6, 2022

Just an update on this: I also encountered this issue today. I'm not entirely sure what caused it, but it was after deleting my unity project files and restoring it to the same place from version control, then exporting the project again, I think this somehow caused Undefined symbol: _OnUnitySceneLoaded and Undefined symbol: _OnUnityMessage Error. I don't know why.

I managed to resolve it by cleaning my build folder, removing the reference to the iPhone-Unity project in xcode, deleting the exported UnityLibrary folder from my ios folder, then re-exporting the project again from Unity and following the steps in the README to re-intergrate the project (adding the iPhone-Unity project to Runner, setting the target membership of the Data folder, and adding the Unity.framework library to the Runner target). Then magically this error message was gone. Hope this helps anyone else who runs into this

@dawiddszewczyk
Copy link
Collaborator

dawiddszewczyk commented Jul 8, 2022

To solve it you have to reimport again unity package (with valid version) in Unity Project,
And then in Unity-iPhone -> data
Zrzut ekranu 2022-07-8 o 23 45 54
have config like below.
Zrzut ekranu 2022-07-8 o 23 45 01

@deepatavy
Copy link

deepatavy commented Aug 2, 2022

  1. Deleted UnityLibrary directory from ios folder (Android Studio)
  2. Created Build for iOS from Flutter Menu (Unity)

Worked for me

@TonyHoyleRps
Copy link
Contributor

That's just placebo though - try it using any kind of source control. You'll find there will be zero changes to the source and nothing to commit. You've not done anything.

It just happens randomly, on clean checkouts, and when it does it's a complete pain as there's no solution except repeatedly restarting the build process. Manually editing intermediate files works on developers machines but is a nonstarter for CI.

@timbotimbo timbotimbo added ios This issue is specific to the iOS/iPadOS Platform. Build This issue refers to the build configuration and builds failing. labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build This issue refers to the build configuration and builds failing. ios This issue is specific to the iOS/iPadOS Platform.
Projects
None yet
Development

No branches or pull requests

6 participants