- Home /
I cannot use Native Plugins using C on iOS
I use Unity5 now. I'm trying to use native plugins as test. My problem is the title, so I cannot use Native Plugins. (Xcode raised a BAD_ACCESS error.)
Flow:
I created an Unity project.
I wrote C# code for using Native code.
I added a C code into a Plugins folder.
Codes are below:
C is
float VersionNumber() {
return 1.0;
}
C# is
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class NativeTest : MonoBehaviour {
[DllImport("__Internal")]
private static extern int VersionNumber();
// Use this for initialization
void Start () {
Debug.Log("Version number is " + VersionNumber());
}
}
These are correct to build, but It will raise a BAD_ACCESS error. WHY?
Comment
Your answer
