Hi, from the title I’m trying to pass a value in this case a file from using Application.CaptureScreenshot which is a string type. The capture screen function is in a js script so I pass the value to cs code. Here’s what I have so far:
//saveToAlbum.cs
private CaptureScreen captureScreen;
[DllImport("__Import")]
extern static public string savePicture(string picture);
private string temp;
void Awake() {
//Get the JavaScript component
captureScreen = this.GetComponent<CaptureScreen>();
}
void Update() {
if(captureScreen.press == true) {
//print(captureScreen.picName);
temp = savePicture(captureScreen.picName);
}
}
It builds fine but now the tricky part for me in calling it in Objective C. So I wrote this:
// MyApplication.h
extern "C" {
NSString *savePicture(NSString *picture);
}
and
// MyApplication.mm
NSString *savePicture(NSString *picture) {
NSLog(@ "@", picture);
return picture;
}
At the moment, this is just to test printing out the names of the pictures. Whenever i run this, xcode crashes and has this in the output console “Unable to resolve pinvoke method”
What am I doing wrong or is there a better way of doing this? If this works I’m hoping to use UIImageWriteToSavedPhotosAlbum.
Appreciate the help, thanks very much.