Question about textures from loaded XAML files
Suppose I have a XAML file that has a very large full screen background texture. That Xaml is my loading image that is used when launching the game.
Once that xaml is removed, is the texture memory associated with that huge background texture also supposed to be freed?
I might be mistaken, but it looks like right now that huge texture is staying resident, even though it's not used and no xaml is actively referencing it. Is there a recommendation here? It seems like I could probably do the texture through a data binding and then manage the memory myself, but I imagine this is a pretty common case, so I was curious what the recommendation is.
thanks,
sam
Once that xaml is removed, is the texture memory associated with that huge background texture also supposed to be freed?
I might be mistaken, but it looks like right now that huge texture is staying resident, even though it's not used and no xaml is actively referencing it. Is there a recommendation here? It seems like I could probably do the texture through a data binding and then manage the memory myself, but I imagine this is a pretty common case, so I was curious what the recommendation is.
thanks,
sam
Re: Question about textures from loaded XAML files
XAML assets retain references to the textures they use. When a XAML asset is unloaded, Unity may also unload the associated texture asset.Once that xaml is removed, is the texture memory associated with that huge background texture also supposed to be freed?
If you need more explicit control over this behavior, consider using Unity's Addressables system. Many of our clients use Addressables to manage such dependencies effectively. Have you explored this approach before?
Re: Question about textures from loaded XAML files
As Jesús mentioned, Addressables is an effective way of managing assets in your UI.
There is an AddressablesImage control on the Showcase forum which loads an Addressable texture when the control is loaded, and releases the asset when the control is unloaded. You can find that here: viewtopic.php?t=2629
There is an AddressablesImage control on the Showcase forum which loads an Addressable texture when the control is loaded, and releases the asset when the control is unloaded. You can find that here: viewtopic.php?t=2629
Who is online
Users browsing this forum: No registered users and 4 guests