internal static BurstPlatformAotSettings GetOrCreateSettings(BuildTarget target) { BurstPlatformAotSettings settings = ScriptableObject.CreateInstance <BurstPlatformAotSettings>(); settings.InitialiseDefaults(target); string path = GetPath(target); if (File.Exists(path)) { var json = File.ReadAllText(path); EditorJsonUtility.FromJsonOverwrite(json, settings); } else { settings.Save(target); } return(settings); }
internal static BurstPlatformAotSettings GetOrCreateSettings(BuildTarget target) { target = ResolveTarget(target); BurstPlatformAotSettings settings = ScriptableObject.CreateInstance <BurstPlatformAotSettings>(); settings.InitialiseDefaults(target); string path = GetPath(target); if (File.Exists(path)) { var json = File.ReadAllText(path); settings = SerialiseIn(target, json); } else { settings.Save(target); } return(settings); }
internal static BurstPlatformAotSettings SerialiseIn(BuildTarget target, string json) { // Deal with pre version 2 format BurstPlatformLegacySettings legacy = (BurstPlatformLegacySettings)ScriptableObject.CreateInstance <BurstPlatformLegacySettings>(); EditorJsonUtility.FromJsonOverwrite(json, legacy); BurstPlatformAotSettings versioned = (BurstPlatformAotSettings)ScriptableObject.CreateInstance <BurstPlatformAotSettings>(); EditorJsonUtility.FromJsonOverwrite(json, versioned); if (versioned.Version == 0) { // legacy file, upgrade it versioned.InitialiseDefaults(target); versioned.EnableOptimisations = !legacy.DisableOptimisations; versioned.EnableBurstCompilation = !legacy.DisableBurstCompilation; versioned.EnableSafetyChecks = !legacy.DisableSafetyChecks; } // Otherwise should be a modern file with a valid version (we can use that to upgrade when the time comes) return(versioned); }