flutter-unity-view-widget icon indicating copy to clipboard operation
flutter-unity-view-widget copied to clipboard

Undefined symbol: _OnUnitySceneLoaded & Undefined symbol: _OnUnityMessage Error

Open prakash-fermion opened this issue 3 years ago • 5 comments

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

prakash-fermion avatar May 07 '22 13:05 prakash-fermion

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 avatar May 27 '22 10:05 jamesncl

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

jamesncl avatar Jul 06 '22 14:07 jamesncl

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

dawiddszewczyk avatar Jul 08 '22 21:07 dawiddszewczyk

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

Worked for me

deepatavy avatar Aug 02 '22 14:08 deepatavy

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.

TonyHoyleRps avatar Sep 20 '22 10:09 TonyHoyleRps