- Home /
Unity-Android Plugin (Black Screen)
I'm making a unity plugin for android. When I run my application on native, it runs perfectly. But when i call the same function from unity, it makes the background black and unity scene (by default in blue colour) doesn't show. What is the problem?
Comment
Answer by FrimaMickD · Sep 06, 2013 at 12:23 PM
Because your android plugin is a compiled .so and thus can only work in native environment. If you want your plugin to also work in the editor you will need to build the equivalent .dll that the editor will be able to use.
An example:
[DllImport ("MyCustomPluginEditor")]//This is the import for MyCustomPluginEditor.dll
private static extern void MyPluginFunctionEditor();
[DllImport ("MyCustomPluginAndroid")]//This is the import for MyCustomPluginAndroid.so
private static extern void MyPluginFunctionAndroid();
function void WhateverFunction()
{
#if UNITY_EDITOR
MyPluginFunctionEditor();
#elif UNITY_ANDROID
MyPluginFunctionAndroid();
#endif
}
Hope this helps!
Your answer
Follow this Question
Related Questions
Android Unity Plugin problem 0 Answers
Inner-active Ads Crashes 0 Answers
Android Unity Plugin - UnityPause(bool pause) 0 Answers