Hello. I just want to clear few things.
I have downloaded simple example from this page
The unity project is working great.
But when I open XCode project I can not compile it. Because I need to change few settings
- Architecture → to Starndart(32/64) bit
- Base SDK → Lastest(OSX 10.8)
The it compiles normal. And I can put it into the project.
But the fun part begins. When I change simple functions inside xCode project, for example:
from
const char* PrintHello(){
return "Hello";
}
to
const char* PrintHello(){
return "Hello222";
}
Inside Unity it steel return’s “Hello” and yes, I am shure that I replaced “ASimplePlugin.bundle”. And when I try to compile project, functions isn’t working. Despite that thay was working in editor second ego.
This is basically first questions. Because I simply cant’ understand what is going wrong.
Here is How try to create simple plugin.
Creating new XCode project
Adding new Objective-C file “Plugin”
Code of Plugin.mm
#import "Plugin.h"
@implementation Plugin
extern "C" {
float HelloWorld () {
//here should be some code
}
}
@end
Then build bundle. Product->Build
Then I putting MyPlugin.bundle inside Assets->Plugins folder
and here is how I try to access my HelloWorld function from Unity.
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.InteropServices;
public class PluginImport : MonoBehaviour {
[DllImport ("MyPlugin")]
private static extern float HelloWorld();
void Start () {
HelloWorld();
}
}
And this what I have so far.
DllNotFoundException: user/Documents/Important/OSX/SimplestPluginExample/Unity Project Plugin/Assets/Plugins/MyPlugin.bundle/Contents/MacOS/MyPlugin.bundle
PluginImport.Start () (at Assets/PluginImport.cs:14)
I will appreciate if some one could tell me what I’m doing wrong. Thx.