Unity - Scripting API: Presets.Preset.GetAllDefaultTypes
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Declaration
public static PresetType[] GetAllDefaultTypes();
Use this method to gather all existing DefaultPreset and all Preset used as default in a project.
using UnityEditor; using UnityEditor.Presets; using UnityEngine;public static class PresetExample { [MenuItem("Presets Example/Log All Default Preset")] public static void LogDefaultPreset() { var defaultTypes = Preset.GetAllDefaultTypes(); foreach (var defaultType in defaultTypes) { var defaults = Preset.GetDefaultPresetsForType(defaultType); foreach (var defaultPreset in defaults) { Debug.Log($"Default - Filter:{defaultPreset.filter}, Enabled:{defaultPreset.enabled}, Name:{defaultPreset.preset.name}", defaultPreset.preset); } } } }