Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ForEach

Executes the given Action for each Quality Level configured in QualitySettings.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

ForEach(Action)

Executes the given Action for each Quality Level configured in QualitySettings.
public static void ForEach(Action callback)

Parameters

callback

The callback to execute for each level.

Remarks

This method iterates through the configured quality levels and invokes the callback for every one. When this method returns, the original quality level is restored.
The following example adds a helper menu item that sets the Vsync Count setting on every quality level to "Don't Sync".

Examples

using UnityEngine;using UnityEditor;public class ForEachQualityLevelExample{ [MenuItem("Tools/Disable Vsync for All Quality Levels")] static void DisableVsync() { QualitySettings.ForEach(() => { QualitySettings.vSyncCount = 0; }); }}

ForEach(Action<int, string>)

Executes the given Action for each Quality Level configured in QualitySettings.
public static void ForEach(Action<int, string> callback)

Parameters

The callback to execute for each level.

Remarks

This method iterates through the configured quality levels and invokes the callback for every one. When this method returns, the original quality level is restored.
The following example adds a helper menu item that sets the Vsync Count setting on every quality level to "Don't Sync".

Examples

using UnityEngine;using UnityEditor;public class ForEachQualityLevelExample{ [MenuItem("Tools/Disable Vsync for All Quality Levels")] static void DisableVsync() { QualitySettings.ForEach(() => { QualitySettings.vSyncCount = 0; }); }}