This page describes Native Code Plugins for the Tizen platform.
[DllImport ("PluginName")]
private static extern float FooPluginFunction();
#include <tizen.h>
EXPORT_API float FooPluginFunction();
If you are using C++ (.cpp) to implement the plugin you must ensure the functions are declared with C linkage to avoid name mangling issues.
extern "C" {
EXPORT_API float FooPluginFunction();
}
Plugins written in C do not need this since these languages do not use name-mangling.
Once built, the shared library should be copied to the
folder. Unity will then find it by name when you define a function like the following in the C# script:[DllImport ("PluginName")]
private static extern float FooPluginFunction ();
Please note that PluginName should not include the prefix (‘lib’) nor the extension (‘.so’) of the filename. You should wrap all native code methods with an additional C# code layer. This code should check Application.platform and call native methods only when the app is running on the actual device; dummy values can be returned from the C# code when running in the Editor. You can also use platform defines to control platform dependent code compilation.
Unity Tizen supports limited native-to-managed callback functionality via UnitySendMessage:
UnitySendMessage("GameObjectName1", "MethodName1", "Message to send");
This function has three parameters : the name of the target GameObject, the script method to call on that object and the message string to pass to the called method.
Known limitations:
function MethodName(message:string)