Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 vahid62 · Oct 30, 2014 at 06:27 AM · variableaccessprocess

How to access .NET application from Unity via a Process?

Hi

I have made a .NET application that get CPU id.

I used the System.Management classes in .NET that isn't supported in Mono.

Now the CPU id is stored in a string variable in .NET application.

How can I access this variable from Unity via a Process?

Is it possible at all?

Comment
Add comment · Show 1
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 _dns_ · Oct 30, 2014 at 01:00 PM 1
Share

Hi, maybe you can convert some information Unity will give you through SystemInfo.processorType ( http://docs.unity3d.com/ScriptReference/SystemInfo.html ) to an equivalent of a CPU ID.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Oct 30, 2014 at 12:02 PM

Either use named pipes which would be the fastest way or use Sockets to exchange information between two .NET processes. However in your case it would probably be simpler you write the information to a file and let Unity read that file.

Comment
Add comment · Show 3 · 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 vahid62 · Oct 30, 2014 at 12:57 PM 0
Share

Thanks for answers, yes the easiest way is to write information to a file and read it with unity. But I want to make a software lock for my unity build and I will change CPU id with an algorithm to have Unique serial number for each computer. For security reasons, if I write this serial in a file that is on hard disk, it is easy for hackers to read it and I search different way for doing it.

avatar image Bunny83 · Oct 30, 2014 at 01:12 PM 1
Share

Well, decompiling a .NET application is also quite "easy" ;)

Also are you aware of the fact that the CPUid is not guaranteed to be unique?. You might have a look at this SO question.

avatar image vahid62 · Oct 30, 2014 at 01:46 PM 0
Share

Yes you are right. I must combine several hardware ids for generate serial. $$anonymous$$aybe I must use SystemInfo class, if i can reach an Unique code with it. what is your idea Bunny? Is it possible?

avatar image
1

Answer by liortal · Oct 30, 2014 at 11:44 AM

There's no easy way to get the string in the memory space of one app from another app.

I would say it would be probably easier to find a better solution that have 2 different apps communicate with each other (e.g: use a native plugin that retrieves this value).

NOTE: this approach would not work on all platforms of course.

You can achieve this in many different ways (See this link for more information on Inter Process Communication).

The easiest way it would be to have the external app report the CPU id value to the console, and have the game execute that app and read its output.

The game would parse the output from your external process and read the value (multiple values can be reported that way, as long as both apps agree on a common structure of what is being output and how to read it).

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

29 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

Related Questions

Can't Access a Prefab 2 Answers

Need to use 2 different language scripts. 1 Answer

Access a JavaScript variable from a C# script? 2 Answers

Is it possible to change a variable, into a script not assigned to any game object? 3 Answers

How to Convert a Variable Name to a String? 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