- Home /
How to integrate Windows.UI.Input.Inking.dll used for pen input with Microsoft Surface Pro?
We are working on a project for Microsoft Surface Pro 4 where we want to detect the pen input. The goal is to draw lines on the screen and track the pen info over time.
We integrated the Windows.UI.Input.Inking.dll in the Asset folder, but were unable to use it in the code for the scripts. We tried many different settings for the project including the full installation of WUP, project references to the dll, without success. From our research on internet, it does not seem to be supported by the current version of Unity.
Still, we continue to think that there is or should be a way to do it. So, does anyone know how to detect the pen inputs or could officially confirm that it is not possible to do so specifically in the case of a Unity project?
*Note that we were able to use the dll in non-Unity project.
*More info: Trying to reference the dll regardless of file location gives the following warning: CS8034 Unable to load Analyzer assembly C:\Windows\syswow64\Windows.UI.Input.Inking.dll: PE image doesn't contain managed metadata. The same goes for Windows.UI.dll.
I know that the question is similar to http://answers.unity3d.com/questions/1297962/microsoft-surface-pen-working-in-editor-but-not-bu.html, but from my point of view, my question focus more on the dll aspect and the pen inputs vs the UI fonctionnalities in the other question.
The product we're developing requires us to get Input from a Pen/Stylus as well. Unfortunatly, Unity does not make it easy, been looking for a solution for a while now.
Hey thanks for taking the time to comment even if you don't have an answer. It means a lot to me just to not be alone with the problem. For me they are the worst kind of problems because I need to dig resources and search very deep and each alternative takes time without a guarantee of providing a solution and it becomes very exhausting. I still continue to dig in. I found a few more additionnal things to try. Seems like at some point in the old versions of Unity the pen was working and since an update it stopped. Be sure that if I find a solution I'll post it here so that you can benefit from it. Please do the same if you manage to find something.
So...this probably isn't an acceptable solution, but I think its worth mentioning... How about you wrap up the functionality in a simple console program? Its just a file after all, so you can include the dll and that program as is in Assets/Strea$$anonymous$$gAssets. (Problems - probably platform dependent; inefficient; and somewhat cumbersome)
Hum, I did not try to use the dll in the Strea$$anonymous$$gAssets to integrate the code after the installation of the game. I guess it might worth a try beside not having the required feature, but for the moment we'll shift on something else and be back at it later. It's not sure if we'll try it in the end. Honestly the real good answer would be around having the pen fully supported by Unity in the Input class (we still hope to find something like that as if we missed it in our research). Thanks for the idea.
I don't want to give you any false hope but I've been experimenting with this (https://github.com/hecomi/uWintab) and it looks quite promising.
@royvaneijndhoven I took a look at the project on github and tried to run it on the Surface Pro. Seems like on your side that you're using a wacom tablet. The preview was looking so promizing. On my side when I run it, all the fields are not initialized in the screen (string name is empty, supported features all false, etc). I don't think the custum library is supported by Surface Pro. Btw, when I press play 90% of the time Unity crashes. I don't know if it is because the project was made on a older version. Anyway, it was really nice to open a project without warning or error messages. I'll keep looking for an answer as I haven't tried everything I could think about yet. Thanks again.