v3.0.3 Unity project setting "Preloaded Assets" for xamls needed?
I upgraded my project from v2.2.x to v3.0.3 .
I developed multi-language localization based on official localization.unity sample.
Here is my class to store necessary resource dictionary.
LocalizedResource() constructor is triggered at very first timing of application launching, before NoesisView.Awake() .
Originally in v2.2.x, there's no problem here (both in Unity editor and runtime standalone player).
After upgraded to v3.0.3, also no problem in Unity editor play mode.
But when I built standalone player, application crashed in LocalizedResource() constructor at trying to load "Localization-en.xaml".
It complains the following exception.
https://imgur.com/dcNEq10
Is it right in v3.0.x, I have to sets xaml assets as "Preloaded Assets" in project settings to be loaded by code correctly at runtime?
I just tried setting Localization-en.xaml as "Preloaded Assets", and then everything back to normal again.
LocalizedResource() loads xaml assets successfully in standalone player.
I developed multi-language localization based on official localization.unity sample.
Here is my class to store necessary resource dictionary.
Code: Select all
public class Localization
{
public string Name { get; set; }
public ResourceDictionary Resources { get; set; }
}
public class LocalizedResource
{
public LocalizedResource()
{
Localizations = new ObservableCollection<Localization>()
{
new Localization
{
Name = "English",
Resources = (ResourceDictionary)GUIUtil.LoadXaml(
"Assets/Xamls/Res/Localization-en.xaml")
},
new Localization
{
Name = "繁體中文",
Resources = (ResourceDictionary)GUIUtil.LoadXaml(
"Assets/Xamls/Res/Localization-cht.xaml")
},
...
};
}
Originally in v2.2.x, there's no problem here (both in Unity editor and runtime standalone player).
After upgraded to v3.0.3, also no problem in Unity editor play mode.
But when I built standalone player, application crashed in LocalizedResource() constructor at trying to load "Localization-en.xaml".
It complains the following exception.
https://imgur.com/dcNEq10
Is it right in v3.0.x, I have to sets xaml assets as "Preloaded Assets" in project settings to be loaded by code correctly at runtime?
I just tried setting Localization-en.xaml as "Preloaded Assets", and then everything back to normal again.
LocalizedResource() loads xaml assets successfully in standalone player.
-
sfernandez
Site Admin
- Posts: 3008
- Joined:
Re: v3.0.3 Unity project setting "Preloaded Assets" for xamls needed?
In 3.0 we no longer provide a list of "Preloaded Assets", what we do is rely on asset dependencies to be more Unity friendly.
You can use our <noesis:Xaml.Dependencies> extension to specify in the root xaml runtime dependencies that you will manually load using LoadXaml. This way you will see when inspecting the root xaml asset that it depends also on those extra xamls.
You can use our <noesis:Xaml.Dependencies> extension to specify in the root xaml runtime dependencies that you will manually load using LoadXaml. This way you will see when inspecting the root xaml asset that it depends also on those extra xamls.
Re: v3.0.3 Unity project setting "Preloaded Assets" for xamls needed?
In 3.0 we no longer provide a list of "Preloaded Assets", what we do is rely on asset dependencies to be more Unity friendly.
You can use our <noesis:Xaml.Dependencies> extension to specify in the root xaml runtime dependencies that you will manually load using LoadXaml. This way you will see when inspecting the root xaml asset that it depends also on those extra xamls.
Yes, I had done that since v2.2.x, and it was no problem.
I met this problem in v3.0.3, but I also tried to build standalone player of "Localization" sample, also no problem.
So currently I can't figure out what's wrong.
I will do some more tests/check on this.
And "Preloaded Assets" I mentioned is in "Project settings -> Player -> Preloaded Assets"
-
sfernandez
Site Admin
- Posts: 3008
- Joined:
Re: v3.0.3 Unity project setting "Preloaded Assets" for xamls needed?
Can you verify that the xaml where you specify <noesis:Xaml.Dependencies> has all the xamls as dependencies in the inspector?I met this problem in v3.0.3
If you go back to unity package 3.0.2 does the standalone work again?
Ok, I was confused with our old entry in Noesis settings for preloaded xamls.And "Preloaded Assets" I mentioned is in "Project settings -> Player -> Preloaded Assets"
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests