Exemple #1
0
        private static void GenerateFile(string[] areaNames = default, int hash = 0, string outputPath = null)
        {
            if (areaNames == null)
            {
                areaNames = GameObjectUtility.GetNavMeshAreaNames();
            }

            if (hash == 0)
            {
                hash = GetAreaHash(areaNames);
            }

            var values      = GetAreaEnumValuesAsText(ref areaNames);
            var newEnumText = ContentTemplate.Replace(EnumValuesToken, values);
            var output      = ReplaceEnumInFile(nameof(NavMeshAreas), File.ReadAllLines(outputPath), newEnumText);

            CreateScriptAssetWithContent(outputPath, string.Concat(output));
            EditorPrefs.SetInt(HashSettingsKey, hash);
            AssetDatabase.Refresh();
        }