Search Unity

Adding project setting fields is too complicated

Discussion in 'General Discussion' started by KimSweden, Jun 9, 2021.

  1. KimSweden

    KimSweden

    Joined:
    Sep 28, 2018
    Posts:
    1
    First post stoke!

    I recently worked on a package and used SettingsProvider to add a global override string representing a path to a ScriptableObject. The ScriptableObject at this path was fetched by an initializer at runtime. I did this to easily let people create and point to their own instance of that ScriptableObject to override the default one, it was the simplest way I felt I could do it.

    HOWEVER.

    SettingsProviders are really complicated and annoying to set up. It's not hard at all, the manual shows exactly how to do it. I just feel like there are way too many steps. Any Editor script I've made has confused me but SettingsProviders made me frustrated. I imagine encapsulating these things isn't trivial but I can dream.

    What do you think about SettingsProviders?
    Do you think I could have solved my problem in a better way?
     
  2. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    I have a library of SO's describing 3200+ isotopes. I simply made a prefab of all the SO's in various List<> and loaded them from that prefab. I can then drop that prefab in any Scene and i have full access to any SO via one line of code.
     
  3. I think it is perfectly fine for what it is doing. It's a generic settings system for various types living in a piece of editor portion.
    You can write this once per package, not a big deal, less than 10-20 minutes if you're slow replacing values and/or names.

    Not better, but completely different and hacky: you can use ScriptableSingleton<T> in the editor. It serializes data in a file and loads up / provides in the editor session. You can choose per editor or per project file storage.

    That's not really solution to the problem above, it doesn't make the end users' life easier to override settings by dropping scriptable object config objects in the settings. Also, kind of kills the best portion of scriptable objects: scene-independence. But that's personal opinion, obviously.
     
  4. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Guess I didn't understand what the package they were using was doing. I am "old fashioned" and write my own editor tools.