Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored user/project settings #96

Conversation

jeffcampbellmakesgames
Copy link
Contributor

Summary

I recently pulled this library as a package into a new project and had a hard time tracking down the settings to disable the debug feature. I realized that some of the existing settings for debugging or gizmos are checked in as part of the Settings scriptable asset which means one developer's preferences could potentially clobber another developer's preferences.

To make it easier to expose these settings to the user in a standard way as well as to separate user preferences off of the checked-in Settings asset, I've created a new preference class that allows easier access for developers to these settings regardless of the Settings asset location and separates the Gizmo/Debug configuration to use Editor Prefs instead.

A developer can now modify their user preferences at the menu item Unity=>Preferences and navigate to the SOArchitecture section as shown below. These are now saved as Editor Prefs and can differ per developer.

image

image

A developer can correspondingly modify the project-wide settings by opening the menu item **Edit=>Project Settings" and navigate to the SOArchitecture section as shown below.

image

image

Using the new search fields for the editor windows (in I believe 2019 and later), you can also search for the SOArchitecture library in either the Preferences and Project Settings window to make it easier to find.

image

One final related change is that I moved the SOArchitecture_Settings instance currently checked in outside of the SO Architecture folder so it would not be included for developers who download this as a package. Including this would potentially prevent them from modifying the contents as well
(usually package contents are protected), but definitely prevents their settings from being overwritten when a new package version is downloaded as package contents are considered disposable when changing versions and are blown away completely during that process. Any customized settings would go away in that circumstance. Its better that this asset is created in the developers Assets/Resources folder initially (just how the Singleton instance creation currently works), but this would be prevented by including this asset in the package contents.

If you have any questions or concerns please let me know on the PR!

* Created SOArchitecturePreferences to enable easy editing of user preferences and project settings from editor windows. On 2018 and earlier, these will be shown in the editor preferences window while on 2019 and later these will be split between the project settings and user preferences windows. The project settings exposed on these windows are still saved as part of a SOArchitecture_Settings scriptable asset.
* Refactored user settings from SOArchitecture_Settings into editor preferences. User preferences for enabling gizmos/debug will now be an editor pref and not be a checked-in setting on SOArchitecture_Settings instance. This allows developers on the same project to have different settings.
* Moved the SOArchitecture_Settings instance out of the library folder as this would prevent users who downloaded this library as a package from modifying their settings (assets in the packages folder are locked from overwriting) as well as at risk of being clobbered when updating the package as the new package version would overwrite any force local changes.
@jeffcampbellmakesgames
Copy link
Contributor Author

Hey, I realize you're probably busy; just bumping this as a reminder.

Fix for bool pref always set/returned as true
@DanielEverland
Copy link
Owner

This is cool, I had no idea you could do this 👍

@DanielEverland DanielEverland self-assigned this Nov 8, 2019
@DanielEverland DanielEverland added this to the Release 1.6.2 milestone Nov 8, 2019
@DanielEverland
Copy link
Owner

I changed the feature a bit. Instead of having a pre-defined settings asset in the resources folder, the asset will generate one for you when needed. It also no longer uses the resources to locate the project settings, instead opting to query the asset database. Also added warnings if more than one settings asset is present in the project.

@DanielEverland DanielEverland merged commit 0fde089 into DanielEverland:master Nov 9, 2019
@DanielEverland
Copy link
Owner

Amazing PR as always, I especially appreciate the in-depth explanations :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants