Documentation

Unity Engine


Unity Engine


BuildProfileGraphicsSettings

A build profile component that overrides the global graphics settings.
Read time 5 minutesLast updated a day ago

Definition

[ExcludeFromObjectFactory]public sealed class BuildProfileGraphicsSettings : ScriptableObject

Remarks

To add these settings to a build profile, use BuildProfile.CreateComponent. To remove them, use BuildProfile.RemoveComponent.
When the build profile is the active build profile, its values replace the matching values in the global graphics settings. Each corresponding GraphicsSettings property returns the build profile's value, and EditorGraphicsSettings.GetShaderBuildSettings returns BuildProfileGraphicsSettings.shaderBuildSettings.
The following example gives the active build profile its own graphics settings, and then makes Unity log shader compilation for that build profile only.
using UnityEditor;using UnityEditor.Build.Profile;using UnityEngine;using UnityEngine.Rendering;public static class BuildProfileGraphicsSettingsExample{ [MenuItem("Example/Log Shader Compilation For Active Build Profile")] static void LogShaderCompilationForActiveBuildProfile() { BuildProfile profile = BuildProfile.GetActiveBuildProfile(); if (profile == null) return; // Copy the global graphics settings into the build profile, unless it already has its own. var graphicsSettings = profile.GetComponent<BuildProfileGraphicsSettings>(); if (graphicsSettings == null) graphicsSettings = profile.CreateComponent<BuildProfileGraphicsSettings>(); // Change the build profile's value. The global graphics settings keep their value. graphicsSettings.logWhenShaderIsCompiled = true; // While the build profile is active, GraphicsSettings returns the build profile's value. Debug.Log($"Log when shader is compiled for {profile.name}: {GraphicsSettings.logWhenShaderIsCompiled}"); } [MenuItem("Example/Use Global Graphics Settings For Active Build Profile")] static void UseGlobalGraphicsSettingsForActiveBuildProfile() { BuildProfile profile = BuildProfile.GetActiveBuildProfile(); if (profile == null || profile.GetComponent<BuildProfileGraphicsSettings>() == null) return; // Remove the build profile's own graphics settings, so that it uses the global graphics settings again. profile.RemoveComponent<BuildProfileGraphicsSettings>(); }}

Properties

Property

Description

cameraRelativeLightCullingWhether Unity uses the camera position instead of the world space origin as the reference point for culling lights.
cameraRelativeShadowCullingWhether Unity uses the camera position instead of the world space origin as the reference point for culling shadows.
lightProbeOutsideHullStrategyHow Unity lights a Renderer that uses Light Probes but is outside the Light Probe tetrahedral hull.
logWhenShaderIsCompiledWhether Unity adds a log entry each time it compiles a shader at runtime.
shaderBuildSettingsThe shader build settings, such as shader defines and keyword declaration overrides.
videoShadersIncludeModeWhether and when Unity includes video shaders 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.