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

Is a Default Resource a good idea?

Discussion in 'Scripting' started by BorisTheBrave, Apr 19, 2021.

  1. BorisTheBrave

    BorisTheBrave

    Joined:
    Nov 18, 2018
    Posts:
    64
    I'm making a package that uses a custom ScriptableObject for configuration, which is then referenced by every component in the package.

    Realistically, most users will never want more than one configuration object, and they need set the same object on every component.

    I want to minimize the amount of work required for users, particularly when starting. I thought I'd try the following:

    Create a default configuration asset in the package itself. Then create a Project Setting that has the path to that asset. The components use that path to locate the default. Users can then either edit the default asset (not safe if there are upgrades), or edit the path. I'll probably make a "Set this as Project Default" button to make it easier.

    Any better suggestions? I've not seem many asset store packages that mess with Project Settings.
     
  2. I use SOs for all my configs no matter I reference it once or many times. Having the ability to make multiple assets with different settings is useful, there are many reasons you can have it (having stable setting and trying out different settings for some reasons at the same time).
    If you played around Unity's latest stuff (SRPs, Localization, Game Foundation, etc), they switched to SOs for configs too.
    I would do the same as they are doing. You can make a button if the config isn't attached, show the button to create a new config, if the config attached, you can hide the button.

    With that said, there are many packages and assets use the project settings too. You can check any of these assets how they are handling the situation: TextMesh Pro, Input System, SRPs, Localization. They all have project settings page.