Topic Author
Posts: 2
Joined: 12 Oct 2013, 21:26

Unity Scene within XAML

23 Nov 2013, 17:24


Does anyone have an example or guidance on how to best embed a Unity 3D scene on an area of a XAML page/control?
Can the 3D scene be interactive while embedded in the XAML?
The basic idea I am told is this:
Use a RenderTexture, connect that texture to the XAML and render the unity scene in that texture.

Thanks in advance.
User avatar
Site Admin
Posts: 3805
Joined: 20 Jan 2012, 17:18

Re: Unity Scene within XAML

26 Nov 2013, 22:40

Hi Fred,

We are going to create a sample showing this because it has been requested many times in the past. The steps do be done are:
  • You need to create a RenderTexture in Unity and have a camera rendering to it. This is described in the Unity docs. The scene can be interactive and animated. You can update it at realtime.
  • You need to use that RenderTexture in a xaml. For that, you need a named image node whose source you will change. This step must be done only once.
Grid grid = GetComponent<NoesisGUIPanel>().GetRoot<Grid>();
Image img = grid.FindName<Image>("img");
img.SetSource(new TextureSource(renderTexture));

Who is online

Users browsing this forum: Bing [Bot], dengfan, Semrush [Bot] and 5 guests