Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Alaitoc · Dec 06, 2016 at 07:38 PM · unity 5augmented reality.net.net-assemblies

Create a .net library for hololens / uwp

Hello together,

i got an issue with one existing dll of us. Basically i try to convert a library of us with some basic network components to a .net version which can be used with unity and the hololens.

The problem i got here that i got it working with unity by using the .net 3.5 base class version of unity, which caused the issue that i cant use it with the hololens since it kinda requires uwp.

And when i tried to use a universal class library it had assembly errors in unity and crashed in visual studio when i ignored unity for that bit.

So basically i need to know to use which .net version to actually work with unity AND the hololens. At this moment iam just trying out everything that i can think off...

Thanks already for your help!

Greetings Alaitoc

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Alaitoc · Mar 13, 2017 at 06:56 AM

Oh yeah, sorry that i didnt answer that question @Thijsvt.

I had to use a universal class library, imported the .dll into the unity project by adding it to the assets. Then i unchecked the plugin for the editor and compiled the project for uwp like you would do it normally for a hololens project. Then you should be able to see and use the referenced library in the created visual studio project.

For the part of the conversion of the old project (xamarin) to uwp. Basically i just created a universal class library and added all files as a link from the old project to the uwp project. The only changes i needed to make were removing threads and replacing them with tasks, so they would be compatible for both projects and needed to add a #ifdef for the network class with the sockets.

If you have any further questions, just ask and i will gladly help you out.

Greetings Alaitoc

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Thijsvt · Mar 13, 2017 at 07:47 AM 0
Share

hey @Alaitoc Thanks for replying. Do you have a thread example code by any chance? I am getting errors when tyring to compile and i think it's related to that part. Also it seems unity does not port my .dll's to the project for some reason.

avatar image Alaitoc · Mar 13, 2017 at 08:24 AM 0
Share

Basically just replace the thread with a task:

         private Task TestThread { get; set; }
 
         public void StartTestThread()
         {
             m_bCancelThread = false;
             TestThread = new Task(testThreadFunc);
 
             TestThread.Start();
         }
 
         private void testThreadFunc()
         {
             do
             {
                 // Do Something
             }
             while (!m_bCancelThread);
         }
 
         public void StopTestThread()
         {
             m_bCancelThread = true;
         }

When are you getting errors when you want to compile though? In Unity or Visual Studio? $$anonymous$$ake sure for each .dll you import to check in Exclude Platforms the Editor. And i selected in the platform settings the sdk to UWP and scriptingbackend Dot Net, but not sure if that has any effect tbh.

In the build settings for windows store, i got Copy References and Unity C# Projects checked aswell.

avatar image Thijsvt · Mar 13, 2017 at 10:09 AM 0
Share

A it seems i forgot to click copy references,

@Alaitoc Thanks for the example! it seems that my code just is not compatible for what i want to do because visual studio keeps complaining even though i use the correct methods that this is not available for my project.

i quess this is just the price we pay for monodevelop :S

avatar image Alaitoc Thijsvt · Mar 13, 2017 at 10:34 AM 0
Share

No problem.

If you could provide some more detail on what you want to use, i probably could provide you more help with it. But maybe it is just not that easily compatible.

Wish you good luck anyway!

avatar image Thijsvt · Mar 13, 2017 at 01:17 PM 0
Share

@alaitoc well it might be a bit to specific but I have 2 scenario's.

  1. I would like to use the azure servicebus SD$$anonymous$$ functions but this is a no-go it seems because well the import doesn't even work.

  2. Then you have the scenario where I want to use simple rest calls but I need to authenticate with the services of "System.Security.Cryptography" which are not able to import because the version of .net is different and the #if Windows_UWP or something similar just are not enough.

If you have any idea or brainfart on how to do this it would be more then welcome but then again I totally understand if that is to much of this is to specific.

avatar image Alaitoc Thijsvt · Mar 13, 2017 at 02:53 PM 1
Share

Sadly i dont have a proper answer to those cases.

Though for 1. you might to check out this link and just maybe the library might be in a state where you can use it.

For 2. there should be core functions from the "System.Security.Cryptography" in UWP of some sort, but they are probably not enough for your scenario. So basically the only the solution would be to do a work around yourself and cut off the part for uwp where it goes wrong and add uwp compatible code from there. But this might be not really possible for you depending on your project and might take some time aswell.

So sorry that i cant really be much of a help, but i would be interested if you gain further insight on these aspects.

avatar image Thijsvt Alaitoc · Mar 13, 2017 at 03:49 PM 0
Share

Wow this might be gold. going to try that library tommorow! Thanks man!

avatar image
0

Answer by Thijsvt · Mar 12, 2017 at 07:36 PM

Alaitoc, Did you find the solution? I am struggeling with exactly the same issues....

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Using .NET 4.6 features not supported by Unity WSA Build 2 Answers

Managed Plugin with System.Device assembly gives error 1 Answer

How can I have vuforia text recognition read in a phrase instead of just a single word. 1 Answer

Vicon DataStream SDK with unity 1 Answer

Why am I getting the Unity failed to run reference rewriter whenever I attempt to build my game? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges