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?

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!