Localization not working on android app name

More
4 years 3 months ago - 4 years 3 months ago #4161 by AnonymousT
Hello, Localization Team
Thank you very much for a great localization plugin. This helps me a lot always.
As I mentioned in the title “Localization not working on android app name” so I will report this.
The issue is casued by SceneManager.GetActiveScene().buildIndex.
The buildIndex gives different values between Play mode and Build.

for example:
[X] = Enabled Scene
[ ] = Disabled Scene

Scene in Build
[ ] TestScene (buildIndex is Play Mode = unable to access, Build = 0)
[X] TitleScene (buildIndex is Play Mode = 0, Build = 1)
[X] GameScene (buildIndex is Play Mode = 1, Build = 2)

I have modified the code slightly base on the cases above.
Hope this would help. Thank you.

Environment:
Unity 2018.4.25f1 OSX 10.15.6

Revisions:
PostProcessBuild_ANDROID.cs
14:PostProcessBuild_Android.OnPostProcessScene()
public static void OnPostProcessScene()
{
    if (EditorApplication.isPlayingOrWillChangePlaymode ||
        EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
    {
        return;
    }
    
    #if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
        bool isFirstScene = (EditorBuildSettings.scenes.Length>0 && EditorBuildSettings.scenes[0].path == EditorApplication.currentScene);
    #else
        bool isFirstScene = EditorBuildSettings.scenes.Length <= 1;
        if (!isFirstScene)
        {
            foreach (var scene in EditorBuildSettings.scenes)
            {
                if (scene.enabled)
                {
                    isFirstScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex == UnityEngine.SceneManagement.SceneUtility.GetBuildIndexByScenePath(scene.path);
                    break;
                }
            }
        }
    #endif
    if (isFirstScene)
    {
        string projPath = System.IO.Path.GetFullPath(Application.streamingAssetsPath + "/../../Temp/StagingArea");
        //string projPath = System.IO.Path.GetFullPath(Application.dataPath+ "/Plugins/Android");
        PostProcessAndroid(BuildTarget.Android, projPath);
    }
}
Last edit: 4 years 3 months ago by AnonymousT.

Please Log in or Create an account to join the conversation.

Time to create page: 0.116 seconds
Template by JoomlaShine