Unity Localized Line Provider does not save changes to dialog line table
samanabo opened this issue · 1 comments
What is the current behavior?
Using unity localization, when a project file is imported it will automatically update the unity strings table to include new entries and metadata from the project's scripts. However, the table and metadata are not marked as dirty in the editor and changes are not saved.
Please provide the steps to reproduce, and if possible a minimal demo of the problem:
Create a project using unity localization. Import a yarn project and script with lines.
Edit the strings table, and note the current saved data.
Modify the yarn script, then build the game. Observe there are no saved changes to the strings table.
This can cause null reference exceptions in a build due to missing lines and metadata entries.
What is the expected behavior?
When a project is imported and string tables are updated, these changes should saved and commited to the strings table.
Unity recommends calling EditorUtility.SetDirty
on the table and the SharedData for the table:
https://docs.unity3d.com/Packages/com.unity.localization@1.4/manual/Scripting.html#editor
https://forum.unity.com/threads/localization-how-to-set-strings-via-scripting.1349855/#post-8521172
EditorUtility.SetDirty(table);
EditorUtility.SetDirty(table.SharedData);
This could be done around line 520 of YarnProjectImporter.
Please tell us about your environment:
- Yarn Spinner Version: v2.3.0-beta2
- Unity Version: 2022.3.0
Thank you! Fixed in the above commit. I also went ahead and set the asset table collection as dirty when AddAssetsToAssetTableCollectionWizard
makes changes to it.