This repository has been archived by the owner on Feb 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from rfadeev/upm-support
Make PlayerPrefsEditor Unity Package Manager compatible
- Loading branch information
Showing
18 changed files
with
1,641 additions
and
1,566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
public class ImportPlayerPrefsWizard : ScriptableWizard | ||
namespace Sabresaurus.PlayerPrefsEditor | ||
{ | ||
// Company and product name for importing PlayerPrefs from other projects | ||
[SerializeField] string importCompanyName = ""; | ||
[SerializeField] string importProductName = ""; | ||
|
||
private void OnEnable() | ||
public class ImportPlayerPrefsWizard : ScriptableWizard | ||
{ | ||
importCompanyName = PlayerSettings.companyName; | ||
importProductName = PlayerSettings.productName; | ||
} | ||
// Company and product name for importing PlayerPrefs from other projects | ||
[SerializeField] string importCompanyName = ""; | ||
[SerializeField] string importProductName = ""; | ||
|
||
private void OnInspectorUpdate() | ||
{ | ||
if (Resources.FindObjectsOfTypeAll(typeof(PlayerPrefsEditor)).Length == 0) | ||
private void OnEnable() | ||
{ | ||
Close(); | ||
importCompanyName = PlayerSettings.companyName; | ||
importProductName = PlayerSettings.productName; | ||
} | ||
} | ||
|
||
protected override bool DrawWizardGUI() | ||
{ | ||
GUILayout.Label("Import PlayerPrefs from another project, also useful if you change product or company name", EditorStyles.wordWrappedLabel); | ||
EditorGUILayout.Separator(); | ||
bool v = base.DrawWizardGUI(); | ||
return v; | ||
} | ||
private void OnInspectorUpdate() | ||
{ | ||
if (Resources.FindObjectsOfTypeAll(typeof(PlayerPrefsEditor)).Length == 0) | ||
{ | ||
Close(); | ||
} | ||
} | ||
|
||
private void OnWizardCreate() | ||
{ | ||
if (Resources.FindObjectsOfTypeAll(typeof(PlayerPrefsEditor)).Length >= 1) | ||
protected override bool DrawWizardGUI() | ||
{ | ||
GUILayout.Label("Import PlayerPrefs from another project, also useful if you change product or company name", EditorStyles.wordWrappedLabel); | ||
EditorGUILayout.Separator(); | ||
bool v = base.DrawWizardGUI(); | ||
return v; | ||
} | ||
|
||
private void OnWizardCreate() | ||
{ | ||
((PlayerPrefsEditor)Resources.FindObjectsOfTypeAll(typeof(PlayerPrefsEditor))[0]).Import(importCompanyName, importProductName); | ||
if (Resources.FindObjectsOfTypeAll(typeof(PlayerPrefsEditor)).Length >= 1) | ||
{ | ||
((PlayerPrefsEditor)Resources.FindObjectsOfTypeAll(typeof(PlayerPrefsEditor))[0]).Import(importCompanyName, importProductName); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "PlayerPrefsEditor.Editor", | ||
"references": [ | ||
"GUID:a478bb7e4764e7d4693af7f70e27dec8" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.