shadowmage45
Topic Author
Posts: 4
Joined: 27 Feb 2019, 20:03

Unity Integration Questions

27 Feb 2019, 22:13

Hi all;

I'm investigating options for creation of UIs for use within Unity game engine, and more specifically from within a mod/plugin for the existing Unity based game Kerbal Space Program.

My initial inquiry is towards the method of integration for UIs created with Noesis and how they are compiled / made available to the Unity engine. As I'm working on an external/third-party addon to the game, I am not able to compile the UI/script with the application, and need some way to load the libraries and XAML files from disk at runtime and create the windows dynamically from plugin code (I am able to load my own plugin code compiled into managed .dll's, and believe I can load other managed dlls at runtime; disk access for file reads is not a problem).

Is this something that is doable with Noesis? Does use of the UI's require everything be 'compiled by Unity into the application', or can the libraries and XAML be loaded at runtime?

Any information is much appreciated;

Tags:
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity Integration Questions

01 Mar 2019, 13:02

Is this something that is doable with Noesis? Does use of the UI's require everything be 'compiled by Unity into the application', or can the libraries and XAML be loaded at runtime?
Yes, it is doable. You can LoadXAML by hand from string.
/// <summary>
/// Parses a well-formed XAML fragment and creates the corresponding object tree.
/// </summary>
public static object ParseXaml(string xamlText)
Hope this helps!

Or, maybe easier, you can create our Unity resources by hand. For example in NoesisXaml.cs, the content member is just the raw XAML.
public class NoesisXaml: ScriptableObject
{
...
    public string source;
    public byte[] content;
...
 
shadowmage45
Topic Author
Posts: 4
Joined: 27 Feb 2019, 20:03

Re: Unity Integration Questions

01 Mar 2019, 16:25


Yes, it is doable. You can LoadXAML by hand from string.
/// <summary>
/// Parses a well-formed XAML fragment and creates the corresponding object tree.
/// </summary>
public static object ParseXaml(string xamlText)
Hope this helps!

Or, maybe easier, you can create our Unity resources by hand. For example in NoesisXaml.cs, the content member is just the raw XAML.
public class NoesisXaml: ScriptableObject
{
...
    public string source;
    public byte[] content;
...
Excellent, thanks for the information, sounds like it should work out nicely for my intended use. I do quite a bit of WPF application design at work, and am eager to be able to use that knowledge and technology to clean up the mess that is the Unity GUI system in my personal modding endeavors.

Might be a few weeks before I get into the project, but this will be my first stop for investigation of potential UIs. Thanks again for the info;

Regards,

John
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity Integration Questions

01 Mar 2019, 16:37

You really welcome. Hope to see you back.
 
jswigartPlayful
Posts: 5
Joined: 13 Mar 2019, 16:50

Re: Unity Integration Questions

14 Jun 2019, 23:31

I'm curious how far you have gotten with tinkering with dynamic non compiled XAML in this way. This sort of example would be a great thing to add to the set of samples that come with NoesisGui

If you are just loading XAML, how do you handle the code behind functionality and such?
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity Integration Questions

15 Jun 2019, 01:16

If you are just loading XAML, how do you handle the code behind functionality and such?
Although possible we do not recommend code-behind in this scenario. The best approach is following MVVM and binding everything to the active data context. Almost all our samples are like that.

Who is online

Users browsing this forum: No registered users and 1 guest