/// <summary> /// Update scenes enum if scenes have changed in build settings /// </summary> static void UpdateSceneEnum() { if (HasSceneEnumChanged()) { Debug.Log("Android Performance Tuner: Scenes enum is updated"); var newSceneEnum = EnumInfoHelper.GetSceneEnum(EditorBuildSettings.scenes); protoFile.AddEnum(newSceneEnum); } }
static Proto.FileInfo CreateProtoFile(DevDescriptor devDescriptor) { var protoFile = new Proto.FileInfo(devDescriptor.fileDescriptor); // Always add scene. protoFile.AddEnum(EnumInfoHelper.GetSceneEnum(EditorBuildSettings.scenes)); protoFile.onUpdate += () => { Action onFail = null; if (File.Exists(Paths.devProtoPath)) { var previousText = File.ReadAllText(Paths.devProtoPath); onFail = () => { File.WriteAllText(Paths.devProtoPath, previousText); }; } Directory.CreateDirectory(Path.GetDirectoryName(Paths.devProtoPath)); File.WriteAllText(Paths.devProtoPath, protoFile.ToProtoString()); if (!ProtocCompiler.GenerateProtoAndDesc() && onFail != null) { onFail(); } else { AssetDatabase.Refresh(); areFidelityMessagesDirty = true; } }; // If files do not exist yet, call OnUpdate to generate them (.proto, .descriptor and .cs). if (!File.Exists(Paths.devProtoPath) || !File.Exists(Paths.devDescriptorPath) || !FidelityBuilder.builder.valid || HasSceneEnumChanged()) { protoFile.onUpdate(); } return(protoFile); }