I have a native plugin, and in one of the functions I call from Unity script I want to get access to the ViewController that Unity is using to display, so I try to call UnityGetGLViewController… but it is not in the scope of my script. It is in AppController.mm, and is not defined in the header file. I am not experienced with objective-c, so I might not be understanding some basics, but how can I give my plugin access to UnityGetGLViewController?
Here is my basic setup:
In testPlugin.h:
#import <Foundation/Foundation.h>
@interface testPlugin : NSObject
{
}
int TestCall();
@end
In testPlugin.m:
#import "testPlugin.h"
@implementation testPlugin
int TestCall()
{
....
UIViewController * unityController = UnityGetGLViewController(); //This doesn't work, the compiler doesn't recognize the function
...
}
@end
These files are in the Unity plugins folder under iOS, they appear in the library directory in the generated Xcode project properly, and I have successfully used this plugin setup for other functionalities (such as screen detection and firewall workarounds), so I know this setup works on a basic level…
Any help would be appreciated!