Search Unity

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:
    80
    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,614
    I usually use EditorPrefs - just a single string containing serialised json.
     
  3. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    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:
    3,296
    If they're meant to be shared, SO is way to go. Otherwise use EditorPrefs.