• 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 MadsKP · Feb 03, 2014 at 11:15 AM · c#communication

Unity3d as OPC Client

I am trying to Connect to a OPC Server using Unity as client.

Has any experience with this?

My problem is that all the .NET OPC client Toolkits or SDK´s out there is either using .NET 4.0, running unmanaged code or using COM/DCOM.

Comment
Add comment · Show 7
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 jrs · Sep 25, 2014 at 01:48 PM 0
Share

Did you find a toolkit to help with this?

avatar image PatHightree · Jan 15, 2015 at 02:00 PM 0
Share

Bump

Any news regarding OPC & Unity ?

avatar image qizl · Aug 04, 2015 at 05:51 AM 0
Share

had you resolved this problem?

avatar image feranti · Oct 07, 2015 at 08:36 AM 0
Share

Has someone succeed to communicate with an OPC server in Unity ? It is a pity to see such a useful post with no answer :(

avatar image MetalxBeat · Feb 19, 2016 at 07:29 AM 0
Share

Did anybody find a solution for this? I currently have the same problem and I tried to use opclabs libraries but they are not .NET compatible. jrs said something about building a bridge using python but I'd prefer to apply it within Unity using C# or JavaScript.

Show more comments

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by jrs · Oct 07, 2015 at 12:31 PM

We ended up building a bridge (using python) that runs as a separate application and communicates with unity via osc or tcp

Comment
Add comment · Show 1 · 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 feranti · Oct 07, 2015 at 12:41 PM 0
Share

Thank you for the answer. That's what I thought...

avatar image
0

Answer by Wilbert-Blom · Jun 08, 2016 at 12:58 PM

If anybody has found a workable solution, paid or not, for reading (and writing) from an OPC server directly from (and to) Unity I would very much like to hear it!

So not through some separate application or tunnelling mechanism.

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
avatar image
0

Answer by feranti · Jun 08, 2016 at 03:55 PM

We also ended up to write a TCP bridge for several reason:

  • the OPC server we were trying to access to was running on a VM. Communication to an OPC server through network is a real pain as you have to modify your windows security settings, as far as I remember

  • Unity is stick to .NET 2.0 (and even a .NET 2.0 subset according your target) and most OPC library are using further .NET versions. Except if you want to rewrite an OPC library from scratch without these .NET requirements, you are quite fucked up there.

So we have developped a simple TCP bridge between Unity and the OPC server. We used the very easy to use OPCDANET library from Advosol (sorry for the ad but the question refers to an eventual paid solution).

Hope it helps

Comment
Add comment · Show 1 · 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 feranti · Jun 23, 2017 at 09:07 AM 0
Share

Further information: The bridge is a TCP client-server running on the V$$anonymous$$. It uses OPCDANET library to get data from the OPC server also running on the V$$anonymous$$. Unity connects on this bridge using TCP as client, then sends the tag it wants to retrieve. The bridge gets the data and transfer it back to Unity.

This way, you don't need to have a remote OPC access on the OPC server. That would need to lower windows security settings, as far as I read on the Internet, because of the very old OLE components used. TCP bridge garantees a reliable communication between Unity and the OPC server.

The pain with that scheme is that you have to create you own bytes message pattern with message ids so you can know which answer from the client answer to which request from Unity. You have to deal with data types you want to retrieve in OPC server in order to cast them back to the right type in Unity. And, of course, handle the TCB buffering : a message can be split in two successive TCP buffers. You must have a mecanism to include each message length in itself to ensure that it is complete and, if it is not, go find the rest of it in the next TCP buffer. Long story short. There is many lectures of that on Internet but it a thing to keep in mind if you deal with huge amount of data at the same time.

avatar image
0

Answer by orudas · Oct 24, 2018 at 07:57 AM

I tried using the code from this source https://github.com/RobinFischer/OPC-UA_Unity , still no luck trying to connect to the OPC UA server.

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.

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

26 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

Related Questions

Multiple Cars not working 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

C# Script interaction between separate locations 1 Answer

Issue with sending information between two scripts 1 Answer

Distribute terrain in zones 3 Answers

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