Exception when adding Language dynamically
- protostarDean
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
5 years 10 months ago #3525
by protostarDean
Exception when adding Language dynamically was created by protostarDean
I am creating and adding a language source data at runtime (The strings are downloaded from the web).
In the latest update (2.8.11) I get an exception here:
Works if there is a guard there, but be great if this was fixed.
Thanks!
In the latest update (2.8.11) I get an exception here:
public void AddLanguage( string LanguageName, string LanguageCode )
{
if (GetLanguageIndex(LanguageName, false)>=0)
return;
LanguageData Lang = new LanguageData();
Lang.Name = LanguageName;
Lang.Code = LanguageCode;
mLanguages.Add (Lang);
int NewSize = mLanguages.Count;
for (int i=0, imax=mTerms.Count; i<imax; ++i)
{
Array.Resize(ref mTerms[i].Languages, NewSize);
Array.Resize(ref mTerms[i].Flags, NewSize);
}
#if UNITY_EDITOR
//!!!! ownerObject is null, causing an exception. !!!
UnityEditor.EditorUtility.SetDirty(this.ownerObject);
#endif
}
}
Works if there is a guard there, but be great if this was fixed.
Thanks!
Please Log in or Create an account to join the conversation.
5 years 10 months ago #3526
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Exception when adding Language dynamically
Hi,
The LanguageSourceData was always meant to be used within a LanguageSourceAsset or a LanguageSource. But I guess its a valid usage to create that object dynamically and use it directly.
Will made the changes to support it.
Hope that helps,
Frank
The LanguageSourceData was always meant to be used within a LanguageSourceAsset or a LanguageSource. But I guess its a valid usage to create that object dynamically and use it directly.
Will made the changes to support it.
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
Please Log in or Create an account to join the conversation.
- protostarDean
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
5 years 10 months ago #3530
by protostarDean
Replied by protostarDean on topic Exception when adding Language dynamically
Awesome! Thanks for that.
I will look out for it in the next update.
I will look out for it in the next update.
Please Log in or Create an account to join the conversation.
5 years 10 months ago #3539
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Exception when adding Language dynamically
I just uploaded v2.8.12b1 to the beta folder that includes a fix for that.
Now all SetDirty calls are safeguarded and you should be able to dynamically create a LanguageSourceData and use it at runtime without having that crash.
Hope that helps,
Frank
Now all SetDirty calls are safeguarded and you should be able to dynamically create a LanguageSourceData and use it at runtime without having that crash.
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
Please Log in or Create an account to join the conversation.
Time to create page: 0.188 seconds