Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Apply Preset to Unity's ProjectSettings assets via Editor API? e.g. GraphicsSettings.asset

Discussion in 'Editor & General Support' started by Arkade, Dec 13, 2019.

  1. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    How can we modify Unity's ProjectSettings assets via Editor API using UnityEditor.Preset ?

    My goal is to switch between desktop and mobile graphics configurations (including SRP) using Presets. However I can't seem to access GraphicsSettings.asset via
    AssetDatabase.FindAssets()
    et al in order to use
    Preset.ApplyTo()
    .

    I found this doc [1] which says to access with SerializedObject and a path but I don't see any way to then use Preset. (The SO approach works for setting the SRP fine.)
    I also noticed this post [2] saying no API access to the ProjectSettings assets (at least at the time of writing). Maybe it's changed since? More details on the workaround would be better than nothing :)

    Any help appreciated.

    1: https://support.unity3d.com/hc/en-u...-can-I-modify-Project-Settings-via-scripting-
    2. https://forum.unity.com/threads/presets-feature.491263/#post-3425618