android / tuningfork

Android Performance Tuner is a library to help developers measure frame rendering time across different devices and game stages. This plugin will help developers integrate Android Performance Tuner into their game.
https://developer.android.com/games/sdk/performance-tuner/unity
Other
54 stars 30 forks source link

OnPostprocessAllAssets does not work on Windows #24

Closed AntonPetrov83 closed 2 years ago

AntonPetrov83 commented 2 years ago

All Unity paths are with Unix separator / while Path.Combine() under Windows uses \ So comparing if (str.Equals(Paths.configPath)) won't work. This breaks the main Setup window.

Fixed with:

        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
            string[] movedFromAssetPaths)
        {
            // handle windows paths.
            var configPath = Path.DirectorySeparatorChar == '/'
                ? Paths.configPath
                : Paths.configPath.Replace(Path.DirectorySeparatorChar, '/');

            foreach (string str in importedAssets)
            {
                // We are interested in knowing when the SetupConfig has been re-imported so that it can correctly be
                // loaded and used by the Init function.
                if (str.Equals(configPath))
                {
                    Init();
                    break;
                }
            }
        }
eristella commented 2 years ago

Hi @AntonPetrov83, thanks for the report! Will insert the fix in the next release expected before end of June.

Cheers, Erica

eristella commented 2 years ago

Hello! This issue has been fixed in the latest release :)