- Home /
How can I send data from WPF application to Unity?
I have a WPF application that reads some data from user and I need that data to control the character on Unity. I don't know how to do this. How can I send data from WPF to Unity? Is it even possible? What is the best way to do it? I also thought of another possibility, but I don't know either if it is a good practice or if it is possible to do. The idea was to embed unity game inside WPF. Maybe it would be easier to pass data from one place to another. Let me know your opinions.
P.S.: I'm not fluent in english and therefore it is likely that my question is not entirely noticeable. Sorry about that.
Answer by wibble82 · Dec 22, 2015 at 11:23 AM
Hi amdnis
This is a windows-only solution, but I'm guessing that's fine because WPF is windows only!
Please look into windows 'pipes' for inter-process communication:
https://msdn.microsoft.com/en-us/library/bb546102(v=vs.110).aspx
This is the simplest way to get 2 processes talking to each other in windows.
Alternatively, you could look into using Sockets, to do network communication between the 2 applications. In .net this is also quite easy. This is a good tutorial:
http://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C
This might be a good way to go (although you'll probably need to investigate threads to do it asyncronously), as it is platform independent and can work easily over a network.
-Chris
Hi @wibble82,
First of all, thanks for the answer.
Yes, that's totally fine!
In the meanwhile I try to do it using a X$$anonymous$$L file. On the WPF side I write data to the file and on Unity side I read it. I'm not sure if this is a good solution or not, so I will take a look into your sugestions, thanks :)
Use comments and not answers when you don't have an answer!!! Converted to comment.
Your answer
Follow this Question
Related Questions
Errors Everywhere when updating unity 1 Answer
Player didnt take damage from the Spikes 1 Answer
Scrollview can't scroll with buttons that have Event Triggers 0 Answers
Code in void not executing 0 Answers