VincentH-Net / CSharpForMarkup

Concise, declarative C# UI markup for .NET browser / native UI frameworks
MIT License
743 stars 43 forks source link

Unity UI Toolkit support #34

Open wilg opened 2 years ago

wilg commented 2 years ago

I would love to use it with Unity's DOM-like UI Toolkit. This would be really helpful since game UI is pretty stuck in the stone age.

I was hoping there would be some kind of simple-ish interface I could implement to add support for an arbitrary UI Framework so I could do this. Any advice here?

VincentH-Net commented 2 years ago

@wilg wrote:

I would love to use it with Unity's DOM-like UI Toolkit. This would be really helpful since game UI is pretty stuck in the stone age.

Supporting Unity's UI Toolkit is an interesting idea.

Looking at Comparison of UI systems in Unity it seems like UI Toolkit is the way to go forward - especially for 2D UI with data binding.

There might be (future?) possibilities to build AR/VR 2D applications this way as well; UI toolkit allows to have screen space UI elements following world space objects.

It looks like UI Toolkit was designed in the same decades-old approach of an XML dialect UXML for UI markup and another (proper human programming) language for UI logic, creating similar problems for developers as XAML and HTML do, which C# Markup aims to solve.

VincentH-Net commented 2 years ago

@wilg wrote:

I was hoping there would be some kind of simple-ish interface I could implement to add support for an arbitrary UI Framework so I could do this. Any advice here?

C# Markup aims to support the full feature set of any .NET UI framework - e.g. even Blazor with it's HTML mixup with C#. This goal precludes defining a least common denominator API for all UI frameworks. The rule is that there are no rules :-)

Instead, C# Markup adds support for each UI framework in codegen logic that encapsulates the specific structure, patterns and conventions of that UI framework (some of which are not formalized / documented or even applied consistently).

I am working towards the state where once a base UI framework is supported, any additional UI libraries that target that UI framework can have their C# markup UI generated automatically - with library author control of the codegen as well.

If there is enough interest I can add support - timing depends on how many devs will want to use it (or when someone wants to hire me in a project that wants to use that)

Atm my advice would be to demonstrate how many devs would want this, or ping me if a suitable project comes along. Hth!