• 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 JasonsFreeTime · Mar 25, 2020 at 03:40 PM · pluginsapiil2cpp.net.net-assemblies

Managed Plugin with System.Device assembly gives error

Hello, I wrote a plugin that references the System.Device.dll assembly. When I put the plugin into the Assets/x64 folder I get this error:

 Assembly 'Assets/Plugins/x64/GpsPlugin_Net4.dll' will not be loaded due to errors:
 Unable to resolve reference 'System.Device'. Is the assembly missing or incompatible with the current platform?
 Reference validation can be disabled in the Plugin Inspector.

I have also added a csc.rsp file to the Assets/Editor directory and it includes the line:

 -r:System.Device.dll

I've tried using both Mono and IL2CPP scripting backend. The Api Compatability Level is .NET 4.x. The System.Device namespace was introduced in .Net 4.0 so doesn't IL2CPP support .Net up to 4.6?

Is there some restriction for certain libraries such as System.Device.dll ? Trying to access the Windows GPS sensor data from Unity? Since this isn't a mobile device I can't use Input.Location.

Can you help @JoshPeterson ?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by JoshPeterson · Mar 25, 2020 at 03:58 PM

Unity does not support System.Device.dll - in fact the base class libraries Unity ships with do not include it. You may be able to manually add it to your project as a managed plugin from Nuget though. See https://www.nuget.org/packages/System.Device.Location.Portable/

Comment
Add comment · Show 2 · 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 JasonsFreeTime · Mar 25, 2020 at 06:35 PM 0
Share

Thanks for the suggestion - unfortunately that Nuget package is only for manipulating GeoCoordinates and not for actually getting the lat/lon from the OS.

BTW - I have assumed that Unity's Input.Location API isn't going to work based on the fact that the documentation says its for portable devices only. Does that mean it will only work for Andoid and IOS devices? I consider my Windows Laptop a portable device so will that Input.Location API work? I have Location Services turned on in my Windows settings.

If it won't work, what exactly will be the reason, like how does it decided if I'm using a portable device or not?

I guess I'll have to try it.

avatar image JoshPeterson JasonsFreeTime · Mar 25, 2020 at 06:46 PM 0
Share

I'm unsure about the Unity API's platform support in this case, sorry. It might be worth a try to see what happens though.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

125 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

"Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default" using .Net 4.6 1 Answer

No Option to Select .NET 4.x API Compatibility 2 Answers

Building Project that contains .NET dependencies with Travis CI 0 Answers

System.IO.Ports with .Net Standard 2.0? 1 Answer

Anyway to workaround .NET 4.0 framework outside/inside Unity? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges