Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
avatar image
2
Question by Gh0s7_ · Sep 04, 2016 at 10:10 AM · c#visual studiowindows 10

Using an exported project as a XAML UserControl

While I know that Unity projects are meant to run as stand-alone applications, I need to make something a little bit different and I need your help.

Basically I'd like to add a 3D scene to my app, which is not a brand new app so I can't start from scratch, and since an Unity exported project will run into a SwapChainPanel I thought that I could just import it in my app and just use it.

This will be way easier than moving the project to Unity's exported solution.

Final goal will be to export & compile Unity project and just update DLLs + project data into my main app to update Unity scene.

I did some tests but I wasn't really lucky, so I feel that I'm missing something.

What I did was to copy all the references from the Unity exported project to my App project, then I moved assets and levels (keeping the same file structure) and finally I copied DLLs and Players folder.

Final result was the app crashing as soon as I loaded the page containing the SwapChainPanel, with an error about missing renderer in game manager (sorry for not being 100% accurate, I don't have the project right now).

So, my question is: is there a way to export a Unity project as a XAML UserControl so that I can just plug it into an already existing app? Being an UserControl is not really mandatory, having it inside a page in my already existing page will be good for now, but I'd like to just use the Unity project inside my app.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by InfiniBuzz · Oct 12, 2016 at 09:41 AM

What I was doing to embed a Unity application inside an application was the following:

  • Create WinForms control (should also work with WPF control, did not try that. if not use WinFormsHost)

  • Start unity process from code, passing the window handle with "-parentHWND" (see link)

  • Communicate to the process using IPC mechanisms

You can find more information about starting unity with commandline attributes on the linked page.

See the table almost at the end of the page (-parentHWND description), there is a little ZIP with an example project which was very helpful to me.

Depending on what "application" you have, the solution will be similar.

Regarding IPC i tried NamedPipes and SharedMemory with no luck so I'm currently sticking with TCP communication.

I also use DLLs from the Application and from within Unity. In order to do that I put the dll project output (dll file) inside the Unity assets so you can access it from unity c# code just as you would with other libraries.

It works but it is not very straight forward.

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 MRNA · Apr 18, 2017 at 09:21 AM

Thank you @InfiniBuzz

Your comments greatly helped to figure out how to use an unity application as a child app.

Truly, I have a small problem with the sample code. Since I am using Windows 10 Universal API, I can't generate executable exe app. The app should be either deployed or installed :(

Do you have any idea how I can bind app in Windows store API

Best Regards Reza

Comment
Add comment · Show 2 · 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 InfiniBuzz · Apr 18, 2017 at 05:23 PM 0
Share

What exactly is the problem you are facing? I didn't try what you are trying so I don't know if or how it works. But if you give some error description or points you are stuck with, me or someone else could help you.

avatar image MRNA InfiniBuzz · Apr 19, 2017 at 07:07 AM 0
Share

Let me explain it. I am developing an application based on Windows IoT environment and capabilities. therefore, I need to use UWP (universal windows presentation) API. by using the application I can read position of several nodes with wireless communication and I would like to use a 3D unity app attached to my main application.

Actually, there is an option in Unity to build for 3D design in Windows 10 environment (Windows Store) .

I tried to add the exported unity app into the main visual studio solution and use it as child xaml page. but I had two issues.

First, It seems the libraries are not compatible and I face with several errors. Second, the 3D objects property are not available in exported unity app. ( I guess the only solution is I have to use IPC)

Regards

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.

Follow this Question

Answers Answers and Comments

233 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 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 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 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 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 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 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 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 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

UWP project can't handle dynamic type and cause crashes 0 Answers

Why after importing Standard Assets my Visual Studio Solution has 3 projects ? 1 Answer

Autocomplete in Visual Studio Code 3 Answers

VS Code or visual studio? 1 Answer

VisualStudio doesn't show code helpers in StateMachineBehaviour 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges