Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Saving in EditorPrefs vs ScriptableObject for editor plugins

Discussion in 'Scripting' started by spvn, Jul 16, 2018.

  1. spvn

    spvn

    Joined:
    Dec 10, 2013
    Posts:
    46
    Hey, wondering what's the usual way of saving settings of custom editor plugins? Do you guys usually use EditorPrefs or ScriptableObject for saving them.

    I like ScriptableObjects due to their modularity (easy swapping of settings), but I'm worried about users syncing their settings across repositories, as different users will have different settings (e.g. directory locations). EditorPrefs thus seem like the way to solve this problem.

    Any thoughts?
     
  2. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,525
    I usually use EditorPrefs - just a single string containing serialised json.
     
  3. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,479
    I would use editorPrefs or if your data is complex I would save your own json file somewhere.
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,328
    If they're meant to be shared, SO is way to go. Otherwise use EditorPrefs.
     
unityunity