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

Value of type 'UnityAppController' has no member 'unityMessageHandler'

Open faridg18 opened this issue 4 years ago • 8 comments

Describe the bug I am past the steps of compiling unity an trying to run the app. Xcode gives me the following message: "Value of type 'UnityAppController' has no member 'unityMessageHandler'"

Screen Shot 2021-06-29 at 10 19 58 AM **Screenshots**

Unity (please complete the following information):

  • OS: iOS 14.0

Smartphone (please complete the following information):

  • Device:iPhone 12 pro
  • OS: 14.0

faridg18 avatar Jun 29 '21 16:06 faridg18

I got the same problem and did find out, that sometimes export did not generate proper AppController class.

What i mean is that the changes that are needed for this package are missing.

Just copy those files to your project ( xxxx/ios/unitylibrary/classes/) and it should be fine. Updated_unity_classes.zip

If you check then you see that there are additional exports which the properties that you need.

camao-apo avatar Jul 16 '21 09:07 camao-apo

I had the same issue. Did you find the solution for it @faridg18 ? Copying the files that @camao-apo provided gave me new compiler error, line 454 in UnityAppController.mm "Use of undeclared identifier 'UnityDisplayLinkCallback'"

jaboyc avatar Jul 18 '21 22:07 jaboyc

I have the same issue, did anyone solve it?

mkster avatar Aug 03 '21 11:08 mkster

So it seems that export from Unity did not went well.

Two questions:

  1. What version of Unity you are using ?
  2. Do you use DisplayLink capabilities ?

camao-apo avatar Aug 03 '21 11:08 camao-apo

  1. 2019.4.27f1
  2. As far as I know no (no idea what that is)

mkster avatar Aug 04 '21 04:08 mkster

ok, here's the solution for those that are not able to read the instructions (including myself):

DO NOT USE THE REGULAR BUILD OPTION WITHOUT THE FLUTTER UNITY PLUGIN!

There is a reason for the existence of this plugin, and it is mandatory to do the export for Android and iOS via the "Flutter" menu.

Just for reference, if you are working on the Unity part and you want to "append" instead of build anew, you might have to fix the Build.cs file in the Plugin like this (just in case the "append" function does not work for you).


For iOS, replace this line in DoBuildIOS() -

var options = BuildOptions.AcceptExternalModificationsToPlayer;

with

var options = BuildOptions.AllowDebugging;

For Android, replace this line in DoBuildAndroid() -

var options = BuildOptions.AcceptExternalModificationsToPlayer;

with

var options = BuildOptions.AllowDebugging;
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;

belveder79 avatar Aug 11 '21 11:08 belveder79

The issue has been asked and answered here: https://github.com/juicycleff/flutter-unity-view-widget/issues/377

It's an error that's occurring when you're exporting the iOS project from Unity using an older FlutterUnityIntegration package. Use this one (v4.1.0): https://github.com/juicycleff/flutter-unity-view-widget/blob/master/scripts/FlutterUnityIntegration-v4.1.0.unitypackage

You'll know that it's exported correctly when your UnityAppController.h file contains these changes: https://github.com/juicycleff/flutter-unity-view-widget/issues/377#issuecomment-831712697

NOTE: Be sure to follow the steps mentioned in the above comment by @belveder79 in order to export iOS without errors.

andyshephard avatar Sep 02 '21 08:09 andyshephard

I just found a reliable way to replicate this error.

Reproduction

  • Set the build target in Unity build settings to anything NOT iOS, like Android or Desktop.
  • Now click Flutter-> Export iOS.

This results in an incomplete build, because any code in #if UNITY_IOS blocks is skipped. However you still see the build successful message.

The build script will change the buildtarget automatically, but somehow the #If UNITY_ keeps the old value.

Current solution

Change the Unity build target before clicking Flutter -> Export.

If you use batchmode or command line, make sure to include -buildTarget iOS in your command.

timbotimbo avatar May 11 '23 10:05 timbotimbo