Answer the question
In order to leave comments, you need to log in
How to call C# code from java in Unity3D?
How to call C# functions from java?
I did not find suitable plugins for midi support, I have to write my own.
The Android API actively uses callbacks, which should call methods asynchronously, in this case, these methods are in C #.
Also, midi commands will need to be transferred to C# code.
Googled the following options:
1) use unitysendmessage
public class PluginWrapper : MonoBehaviour {
...
void Update () {
AndroidJavaObject device = plugin.CallStatic<AndroidJavaObject>("getDevice", midiManager, 1);
Debug.Log("UPDATE!!!!!!!!!");
}
void ApplyDamage(string str)
{
Debug.Log("TEST!!!!!!!!!" + str);
}
}
public static MidiDeviceInfo getDevice(MidiManager m, int num){
UnityPlayer.UnitySendMessage ("PluginWrapper", "ApplyDamage", "Message to send teststr");
return m.getDevices()[num];
}
public class DeviceCallback : AndroidJavaProxy
{
public DeviceCallback() : base("android.media.midi.MidiManager.DeviceCallback") { }
void onDeviceAdded(AndroidJavaObject info)
{
Debug.Log("TEST!!!!!!!!!");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question