Documentation

Unity Engine

Download Unity

Unity Engine

shadows

Real-time Shadows type to be used.
Read time 1 minuteLast updated 3 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static ShadowQuality shadows { get; set; }

Remarks

Important: This API is compatible only with the Built-In Render Pipeline, which is no longer supported. To control shadows in the Universal Render Pipeline (URP), use Cast Shadows under Lighting > Main Light and Additional Lights, and Soft Shadows under Shadows in the URP Asset.
This determines which type of shadows should be used. The available options are Hard and Soft Shadows, Hard Shadows Only and Disable Shadows.
Additional Resources: Light.shadows.

Examples

using UnityEngine;// Let the shadow quality be selectedpublic class ExampleScript : MonoBehaviour{ private int selection = 0; private string[] itemName = {" Disable ", " HardOnly ", " Hard and Soft "}; void Start() { QualitySettings.shadows = ShadowQuality.All; } void OnGUI() { GUILayout.BeginVertical("Box"); selection = GUILayout.SelectionGrid(selection, itemName, 1, GUILayout.MinWidth(200), GUILayout.MinHeight(100)); GUILayout.EndVertical(); switch (selection) { case 0: QualitySettings.shadows = ShadowQuality.Disable; break; case 1: QualitySettings.shadows = ShadowQuality.HardOnly; break; default: QualitySettings.shadows = ShadowQuality.All; break; } }}