Combining Windows 10 features with Unity games in your own plugin

Play Combining Windows 10 features with Unity games in your own plugin
Sign in to queue

Description

In case you're curious how to add Universal Windows Platform functionalities that isn't already covered with Unity APIs or with existing plugins - here is how you can write your own plugins targeting UWP.

Edit: one little correction, instead of checking all boxes for the stub plugin, just select the "Editor" box.

Or you quickly look at the unity explanation.

- Create two folders in Unity, Plugins and Plugins\WSA

- in Visual Studio, create a project (Visual C#, Windows Universal, Class Library with .NET 4.6)

- create a new class file naming it after the contained functionality

- in the same, newly created solution: create a subproject (visual c#, classic desktop, class library with .NET 3.5). This will be a stub.

- change the build architecture to "Any CPU"

- delete both Class1.cs-files

- in the stub project, add an existing element, search for the previously created class and add it as a Link. Hit the little down-arrow next to "add" for that.

- put "using System.Threading.Tasks;" between "#if NETFX_CORE" and "#endif" as compiler directives.

- make the "class Plugin" public

now change the properties of both projects

- the build path of the original class library project should be the unity game folder\Plugins\WSA

- the stub project gets a new assembly name and standard namespace - it should be exactly the same as the other project's

- the output/build path should be unity game folder\Plugins

Build the solution to unity :)

Switch to Unity:

- the DLL in the plugins\WSA folder should be linked to the placeholder in the plugins-folder

Feel free to follow me on my

Facebook Page & Twitter:

Embed

Download

Download this episode

The Discussion

  • User profile image
    Rick Barraza

    Hi Kristina! Great post. Jason Fox on my team was just talking to me about your Unity / IOT hackfest project this morning (small world). Since I've been doing Kinect V2 work with Unity (and OpenCV), I've been mainly on Win32, but since we can now start accessing Kinect data from Win10 UWP as of last week, I need to learn the async / await / UWP / etc. stuff. This post is a great first start, and I hope you make more! Happy to share what I work out as well. Again, great job and glad we have another evangelist being so public on Unity + UWP!

  • User profile image
    shady

    Hey , if I download a library from nuget how should I export that to make sure my plugin is working flawlessly.

Add Your 2 Cents