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

Store preferences per project #5

Closed
AlbertoFdzM opened this issue Jul 24, 2016 · 9 comments
Closed

Store preferences per project #5

AlbertoFdzM opened this issue Jul 24, 2016 · 9 comments

Comments

@AlbertoFdzM
Copy link
Contributor

AlbertoFdzM commented Jul 24, 2016

Change the way that the preferences get stored to allow having different configurations on each project.

Currently all the preferences are being stored with EditorPrefs which saves those values on the system and are shared with all the project.

The settings should be stored in the project folder, maybe the only value that should be stored in the EditorPrefs is the Aseprite path.

Note: Use of PlayerPrefs could solve the problem or this tool could be helpful ProjectPrefs

@edwardrowe
Copy link
Contributor

I am currently working on this fix for my team as well. I'm using a scriptable object, and right now I'm just using it to store the non-looping clips. Will submit a PR when I'm done, probably this week.

@edwardrowe
Copy link
Contributor

Ideally the solution would also allow users on one project to share their settings better. Using PlayerPrefs (PR #8) is an improvement over EditorPrefs, since it won't share the settings across projects, but it doesn't allow multiple users to share settings.

I think the only fix is to put the settings in a file that is stored in source control. I've seen several good assets such as DoTween just use a ScriptableObject in the Resources folder, which is the fix I'm working on atm for my team.

@AlbertoFdzM
Copy link
Contributor Author

@edwardrowe you're right I think too that it would be better to have this settings stored in the project source and being able to be tracked by the control version system.

Meanwhile that solution get applied this is a good workaround.

@talecrafter
Copy link
Owner

A custom asset (Scriptable Object) seems to be a good solution so the settings get tracked by the version control system.
Do you see any reason why it should be in the Resources Folder and not somewhere else?

@edwardrowe
Copy link
Contributor

Good question - My main reason for using "Assets/Resources/AnimationImporter/" is to keep the tool from breaking if users want to move AnimationImporter to a different folder (e.g. "Assets/CustomAssets/AnimationImporter"). If you specify the whole path to the settings ("Assets/AnimationImporter/AnimationImporterData.asset"), and they move the tool, it won't know where to find the new settings.

Resources is nice because it's probably a folder that exists already for users, and it seems like a fairly common convention for custom tools. You also specify the path to the Resources file relative to the Resources directory, which means in theory we could store the settings at "Assets/AnimationImporter/Resources/AnimationImporterData.asset", but we'd have to be sure to generate / load it from the correct directory in the first place. I think once it's generated, it might even work to move it (provided you move it somewhere inside a Resources folder).

I would love to hear other ideas for location though, if you have any.

@talecrafter
Copy link
Owner

Nah, that's a good explanation. Maybe Unity should have designated a typical folder for this, but as it is Resources seems to be the convention and those few bytes included in a build are negligible anyway.
If you have a solution already feel free to post it, otherwise I'll take a look at it in the near future.

@edwardrowe
Copy link
Contributor

edwardrowe commented Jul 27, 2016

Ok. I'll do some more research on it cause I'm actually writing a blog post
on this topic as well. Hopefully I'll be submitting a PR tonight.

I totally agree about wanting a common folder or even API for this type of
thing.

edwardrowe added a commit to redbluegames/AnimationImporter that referenced this issue Jul 28, 2016
This addresses issue talecrafter#5 on GitHub by storing shared settings in an asset that can be stored in
version control.
@edwardrowe
Copy link
Contributor

Almost finished this up. I now just need to make sure I use PlayerPrefs instead of EditorPrefs, where it makes sense.

edwardrowe added a commit to redbluegames/AnimationImporter that referenced this issue Jul 28, 2016
This addresses issue talecrafter#5, where preferences were incorrectly preserved across projects, and not
preserved for multiple users.
@talecrafter
Copy link
Owner

Merged with commit f66743b

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

No branches or pull requests

3 participants