Page 1 of 1

Whats the right way to handle noesis:Xaml.Dependencies

Posted: 10 Oct 2026, 22:29
by alfiare
I'm recently upgraded to 4.0 and have moved all my UserControls (200+) to have the AssetDependency attribute and can get everything working.
In our project we do a ton of dynamic loading, models determining what controls get shown, template selectors etc. This all means that there are not direct dependencies in the XAML for them. I've made things work with noesis:Xaml.Dependencies declaring the things that are loading dynamically.

Our project is roughly 3 top level window XAML's that are chosen based on the mode the game is in. At the moment I have many noesis:Xaml.Dependencies in each one based on all the dynamically loaded things, lots of duplication between them, I wish there was a way to not have all the duplication of them, maintaining it sux.

What's the right way to do that?
Should I have one xaml that has all the dependencies that are ever dynamically loaded in it and reference that from top level window xaml's?
Should I put noesis:Xaml.Dependencies in many user controls that have dynamic things they load?
Is there any way that doesn't involve putting these noesis:Xaml.Dependencies in many places?
Is there any better way for a large project I'm not thinking of?

Re: Whats the right way to handle noesis:Xaml.Dependencies

Posted: 13 Oct 2026, 15:28
by jsantos
An alternative is to have a single XAML file containing only noesis:Xaml.Dependencies to every UserControl, then call `NoesisXaml.RegisterDependencies` on that asset during initialization.

Note that you'll need to store a reference to this root XAML asset somewhere, such as in a `ScriptableObject` or Unity's Preloaded Assets list, so you can access it at initialization time.

This will register all your controls, and you won't need extra Xaml.Dependencies in other XAMLs.

Re: Whats the right way to handle noesis:Xaml.Dependencies

Posted: 13 Oct 2026, 18:10
by alfiare
Is there any significant downside to having additional things listed as dependencies if they don't get used 90% of the time? Is it a significant memory footprint or something?

Re: Whats the right way to handle noesis:Xaml.Dependencies

Posted: 14 Oct 2026, 00:05
by jsantos
No, it is not. The dependency simply keeps a reference to the asset so Unity includes it when building the player.

Memory is allocated when each UserControl is instantiated.