DJI SDK Unity Plugin

Do you guys want to have a Unity plugin for a DJI SDK?
If so, what kind of features are you interested in?

1 Like

Would this be built on top of the new Windows SDK from DJI?

I was thinking more of a cross-platfrom plugin that will be built on top of iOS, Android & Windows DJI SDK.

Yes, of course if it’s possible to make DJI sdk for unity that can use the video output as camera reference for tensor-flow to detect specific objects, and build it as android app, so the android app is the controller and the view port for what does the camera sees and make several things with it to unlock the opportunities !

Hi, I’m Muhammad. I am working on DJI - UNITY integration. Need help

Hi Muhammad, I am just investigating the possibilities of such integration of DJI drones (spark, mavic) into Unity. From what I have learned, I assume that there is no ready to paste some dll solution into Unity project in order to read the data directly from the drone. To solve this, I am thinking about three possible approaches (just ideas, don’t know if that would work):

  • Make a Unity project and do all Unity related stuff there → export it to Android Studio project (or iOS) → include the DJI Mobile SDK and bind the data to your Unity stuff in Android Studio → deploy your app to your mobile device
    OR
  • Create some data pre-processing application in Android Studio using the DJI Mobile SDK → forward the drone data from mobile device over some websocket API to the Unity application
    OR
  • Create an Android plugin for Unity containing the DJI SDK (don’t have experience with building plugins, so I don’t know how difficult that would be)

What are your thoughts? Have you advanced somehow or have some ideas to share?

This can be done the same way as any native plugin.
All you need to do is just place all the native SDK into the Unity project. You can even use Play service resolver for that.
Once it’s done you can make a function for every SDK API endpoint and then control it with C# code from Unity.

It’s pretty straight forward, unfortunately not many people are expensive need in this, thanks to why I decided not to work on it atm.
The only tricky part is the video stream, the drone will give you encoded frames data, and you will have to decode it yourself.

Ok, I have downloaded the SDKs (in AAR format) from the MVNRepository and placed them into my Unity project. As far as I understand, now I have to write some C# wrapper inside the Unity, using the AndroidJavaClass and AndroidJavaObject and their methods. Am I correct?

For instance:

public class DroneVideoFeed : MonoBehaviour
{
    private AndroidJavaObject DJISDKManager;

    void Start() {
        DJISDKManager = new AndroidJavaObject("dji.sdk.sdkmanager.DJISDKManager");

        DJISDKManager.Call("some_java_method_of_the_DJISDKManager");
    }
}

The code will create me an DJISDKManager instance, through which I am able to call the DJISDKManager related methods. So if I want to recreate for instance this Camera application from the DJI tutorials projects for Android in Unity, I have to manually create the AndroidJavaObject/AndroidJavaClass for every java class of the SDK I want to work with inside the Unity. Is this the correct approach? Or is there something more convenient?

It takes a lot of boilerplate code to manipulate java classes from the Unity C#.
I would rather recommend making own android plugin.
Btw I made a helper package for making the Android plugins feel free to check it out:

Hi
I have a project to develop an application using AR Foundation in Unity 3D, and I would like to get the data from the sensors of a DJI UAV, using the DJI Mobile SDK, but I am not getting it. I saw that you are already in a much more advanced stage of knowledge than I am.

I would like help with this project, if it really can be implemented.

Thanks for listening.

1 Like

I am looking to control a virtual camera in Unity by panning and tilting a physical tripod with a Force Pro attached. Is this possible with the DJI SDK? Has anyone tried this yet?

I have a training app, and dji users would like to use their controller instead of screensticks or bt Xbox.

How difficult is it to access dji joysticks that are connected to mobile devices using USB cable?