x


is it possible to use Unity inside wpf

Hi, I would like to make an program using Unity and WPF component.

Basically, The program shows 3d Object using Unity engine inside the frame

which has several components from WPF.

so the main frame is made by "WPF", inside main frame(WPF), we would like to use

unity engine. I've watched some videos from Youtube,

they show me that we are able to use WPF components inside unity program.

it seems like using a special tool, but I have no idea about it

is that possible? if so, how would I like to do this? Thank you =) (Sorry for my English, Eng is my 2nd language, so some grammar mistakes might exist)

more ▼

asked Apr 27 '12 at 08:38 AM

freesora gravatar image

freesora
15 1 1 1

I am also looking for the same kind of solution. Have you found anything?

Jun 14 '12 at 03:45 PM amw157
(comments are locked)
10|3000 characters needed characters left

2 answers: sort newest

You can do this by getting Unity Handle and setting the Control's handle to Unity's handle with SetParent(). You will also need to call SetWindowLong() to hide the border of the Unity window and you might also need to position the Unity window at the top left of the control by calling MoveWindow().

If you don't know what I mean here is the sample code below. This starts Unity waits for the process to load and parents it to the control UnityPanel which is a Panel. Then removes the boarder from the window and positions Unity at the top left corner of the control. You will want to make sure that you run your game in window mode.

mUnityProcess = Process.Start(mUnityStartInfo); mUnityProcess.WaitForInputIdle(); mUnityHandle = mUnityProcess.MainWindowHandle; SetParent(mUnityProcess.MainWindowHandle, UnityPanel.Handle); SetWindowLong(mUnityHandle, GWL_STYLE, WS_VISIBLE); MoveWindow(mUnityHandle, 0, 0, UnityPanel.ClientSize.Width, UnityPanel.ClientSize.Height, true);

more ▼

answered Aug 25 '12 at 08:28 PM

RobW81 gravatar image

RobW81
1 3 3 6

(comments are locked)
10|3000 characters needed characters left

Are you sure the "Unity" in the video is in fact Unity3D? Microsoft has a .NET product called Unity (contained in PRISM). It has nothing to do with games, but used for dependency injection.

more ▼

answered Jun 14 '12 at 04:23 PM

Drunken Monkey gravatar image

Drunken Monkey
1

Well you might be able to make the web client run inside a WPF app - using some kind of embedded browser perhaps?

Jun 14 '12 at 04:24 PM whydoidoit
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x846
x137

asked: Apr 27 '12 at 08:38 AM

Seen: 1004 times

Last Updated: Aug 25 '12 at 08:28 PM