PreferenceItem is deprecated. Use [SettingsProvider] instead
UnityEditor.SettingsWindow:OpenUserPreferences()
Would like this nugget to not annoy my console which I actually use for my own dev
PreferenceItem is deprecated. Use [SettingsProvider] instead
UnityEditor.SettingsWindow:OpenUserPreferences()
Would like this nugget to not annoy my console which I actually use for my own dev
So use [SettingsProvider] instead?
I would, but itās your code doing it, not mine. Happens every compile from something in 2018.3 / HDRP 3.0
Found something:
Do you use the post processing package?
Iām getting the same error and Iām not using the Post Processing package.
It started happening after I opened the Preferences window and now it happens constantly on code compile.
Yep, that sounds about right.
Seems to also happen with Pro Builder.
If youāre not using that either, could you please report a bug with the package manifest of the project, in which the error occurs, attached?
Just dock the new preferences and editor settings tab next to scene view, should do it each time its compiling from there on.
Canāt reproduce.
Hi LeonhardP,
we require examples how to use the [SettingsProvider] class for save/load stuff. The warning occur on several assets from the asset store now, because they use the preference settings to store Unity Editor Seettings.
We also use the [PreferenceItem()] for our editor variables extensively.
[PreferenceItem("ConsolE")]
public static void OnGUI() {}
[PreferenceItem("Compiler")]
public static void OnGUI() {}
[PreferenceItem("Amplify Texture 2")]
public static void OnGUI() {}
[PreferenceItem("DTK Splines")]
public static void OnGUI() {}
etc etc....
#pragma warning disable xxx. does not work because there is not value given for :
Trying to register preference item: āCompilerā. [PreferenceItem] attribute is deprecated. Use [SettingsProvider] attribute instead.
Did you have a solution to suppress all these warning about [PreferenceItem]
This is really annoying!
The goal of the warning was to boost user awareness of the new [SettingsProvider] API. We will remove the warning and mark [PreferenceItem] as obsolete instead. It will be less āin your faceā.
I canāt remember when it started but Iām getting it with Cinemachine:
Trying to register preference item: āCinemachineā. [PreferenceItem] attribute is deprecated. Use [SettingsProvider] attribute instead.
SettingsProvider based on UnityEditor. Can you provide a simple example to create an SettingsProvider.asset and load and save some fields? That would be very handy. Thank you.
Search for [SettingsProvider] in this .cs file:
https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/Inspector/GraphicsSettingsInspector.cs
Thank youā¦
Seems an ungly task to exploreā¦
Pasting how to migrate your old [PreferenceItem] code in the most barebone way just in case someone want to get rid of the warning quickly :
#if UNITY_2018_3_OR_NEWER
private class MyPrefSettingsProvider : SettingsProvider
{
public MyPrefSettingsProvider(string path, SettingsScopes scopes = SettingsScopes.Any)
: base(path, scopes)
{ }
public override void OnGUI(string searchContext)
{
MyOldPrefCode();
}
}
[SettingsProvider]
static SettingsProvider MyNewPrefCode()
{
return new MyPrefSettingsProvider("Preferences/MyPref");
}
#else
[PreferenceItem("MyPref")]
#endif
static void MyOldPrefCode()
{
EditorGUI.BeginChangeCheck();
....
}
Hopefully Unity will update as well
Mine comes from āUnityEditor.SettingsWindow:OnEnable()ā
Thanks, I used it on Zios Theme Editor: https://github.com/z3nth10n/unity-themes/commit/d2a3de9ab931e23e55ecd8eb7909cd706f28b585