I want to develop a new CAD software in WPF and instead of using WPF 3D, is it possible to use Unity3D as my graphic engine that is capable of rotate, pan, zoom and view 3D graphic objects based on my data objects in WPF?
The reason I am asking this question is, Unity is a game engine, it uses C# as script but it does not provide any integration from WPF application (embeds Unity into WPF).
I asked the question in unity forum, could not find any good answer, so asking to a larger audience.
This can be done but it's worth noting that it will only work on Windows.
It used to be hard to do this but Unity recently(4.5.5p1) added
-parentHWND
command that can be used to embed its program into another program. All you have to do is build your Unity app, then from WPF, start it with theProcess
API. You can then pass the-parentHWND
parameter to the Unity app.For commutation between the two, you can either use TCP or Named Pipes.
Below is a complete sample of the embed code from Unity's website. You can get the whole project here. Make sure to name the Unity's build exe file "UnityGame.exe" then place it in the-same directory as the WPF exe program.