0
\$\begingroup\$

I created NativeCallProxy.cs in Unity

    public class NativeCallProxy: MonoBehaviour
    {
        [DllImport("__Internal")]
        public static extern void iOSUnloadUnityGame();

        public static void UnloadUnityGame()
        {
#if UNITY_IPHONE
            // Now we check that it's actually an iOS device/simulator, not the Unity Player. You only get plugins on the actual device or iOS Simulator.
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                iOSUnloadUnityGame();
            }
#endif
        }
    }

and created two files in Assets/Plugin/iOS NativeCallProxy.m

#import <Foundation/Foundation.h>
#import "NativeCallProxy.h"

@implementation UnityBridgeAPI
id<UnityBridgeNativeCallsProtocol> api = NULL;
+ (void) registerAPIForNativeCalls:(id<UnityBridgeNativeCallsProtocol>)proxy {
    api = proxy;
}
@end

and NativeCallProxy.h

#ifndef NativeCallProxy_h
#define NativeCallProxy_h

@protocol UnityBridgeNativeCallsProtocol
@required
- (void)unloadUnityGame;
@end

__attribute__((visibility("default")))
@interface UnityBridgeAPI: NSObject
+ (void) registerAPIForNativeCalls:(id<UnityBridgeNativeCallsProtocol>)proxy;
@end


#endif /* NativeCallProxy_h */

and when I try to compile exported project I get an error in Xcode.

enter image description here

How can I figure out it?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Just as the error says. You haven't defined "iOSUnloadUnityGame" that you have used in your NativeCallProxy class. You do have a method called "unloadUnityGame".

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .