Documentation

Unity Engine


Unity Engine


BuildProfileQualitySettings

A build profile component that overrides the global quality levels for the build profile's platform.
Read time 5 minutesLast updated 8 hours ago

Definition

[ExcludeFromObjectFactory]public sealed class BuildProfileQualitySettings : ScriptableObject

Remarks

To add these settings to a build profile, use BuildProfile.CreateComponent. To remove them and use the global quality levels again, use BuildProfile.RemoveComponent.
The following example gives the active build profile its own quality levels. It then includes only the first quality level in builds created with that build profile.
using UnityEditor;using UnityEditor.Build.Profile;using UnityEngine;public static class BuildProfileQualitySettingsExample{ [MenuItem("Example/Use First Quality Level For Active Build Profile")] static void UseFirstQualityLevelForActiveBuildProfile() { BuildProfile profile = BuildProfile.GetActiveBuildProfile(); if (profile == null) return; // Copy the global quality levels for the build profile's platform, unless it already has its own. var qualitySettings = profile.GetComponent<BuildProfileQualitySettings>(); if (qualitySettings == null) qualitySettings = profile.CreateComponent<BuildProfileQualitySettings>(); string[] qualityLevels = qualitySettings.qualityLevels; if (qualityLevels.Length == 0) return; // Include only the first quality level, and start the build with it. // The global quality levels don't change. qualitySettings.qualityLevels = new[] { qualityLevels[0] }; qualitySettings.defaultQualityLevel = qualityLevels[0]; Debug.Log($"Quality levels for {profile.name}: {string.Join(", ", qualitySettings.qualityLevels)}"); } [MenuItem("Example/Use Global Quality Levels For Active Build Profile")] static void UseGlobalQualityLevelsForActiveBuildProfile() { BuildProfile profile = BuildProfile.GetActiveBuildProfile(); if (profile == null || profile.GetComponent<BuildProfileQualitySettings>() == null) return; // Remove the build profile's own quality levels, so that it uses the global quality levels again. profile.RemoveComponent<BuildProfileQualitySettings>(); }}
Additional Resources: BuildProfile, QualitySettings.

Properties

Property

Description

defaultQualityLevelThe name of the quality level that the build uses at startup.
qualityLevelsThe names of the quality levels to include in the build.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.