Localization Package Version: 1.5.3
Issue: Unable to create localization assets (e.g., Locale Asset, String Table Collection Asset).
Cause:
The MakePathRelative method in the Localization package(PathHelper.cs) fails on Windows due to inconsistent drive letter casing between paths.
Code Reference:
internal static string MakePathRelative(string path)
{
var dataPath = Application.dataPath;
var root = dataPath.Substring(0, dataPath.Length - "Assets".Length);
if (path.StartsWith(root))
{
path = path.Substring(root.Length);
}
return path;
}
Details:
- Paths returned by
EditorUtility.SaveFolderPaneluse a lowercase drive letter (e.g.,c:/UnityProjects/Sample/Assets/I18n), whileApplication.dataPathuses an uppercase drive letter (e.g.,C:/UnityProjects/Sample/Assets). - This mismatch causes the
path.StartsWith(root)check to fail, preventing the path from being converted to a relative path. - Since the path remains absolute, AssetDatabase.CreateAsset fails to create the specified assets.
My Fix:
I copied the Localization package to the Packages folder and modified the code as follows:
if (path.StartsWith(root, StringComparison.InvariantCultureIgnoreCase))
Question:
- Is there a way to resolve this issue without modifying the package code directly?
- Will this issue be addressed in a future release?