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

Minor compatibility issues with Unity 2021.1 #1051

Closed
t-mat opened this issue Jun 18, 2021 · 4 comments
Closed

Minor compatibility issues with Unity 2021.1 #1051

t-mat opened this issue Jun 18, 2021 · 4 comments
Milestone

Comments

@t-mat
Copy link

t-mat commented Jun 18, 2021

Describe the bug

When I've imported UniVRM-0.77.0_4a14.unitypackage to Unity 2021.1.12f1 project, it reports the following error:

Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI
UnityEditor.SettingsProvider:.ctor (string,UnityEditor.SettingsScope,System.Collections.Generic.IEnumerable`1<string>)
UniGLTF.UniGLTFPreference:CreateProjectSettingsProvider () (at Assets/UniGLTF/Editor/UniGLTF/UniGLTFPreference.cs:43)
UnityEditor.SettingsWindow:OnEnable ()

After I fixed above error, I've also seen the following error:

Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI
UnityEditor.SettingsProvider:.ctor (string,UnityEditor.SettingsScope,System.Collections.Generic.IEnumerable`1<string>)
VRM.VrmPreference:CreateProjectSettingsProvider () (at Assets/VRM/Editor/VrmPreference.cs:17)
UnityEditor.SettingsWindow:OnEnable ()

Since they're independent classes for Preferences dialog, it seems both UniVRM and UniGLTF runtime/editor code works fine though.

To Reproduce

  1. Create a new project with Unity 2021.1.12f1.
  2. Import UniVRM-0.77.0_4a14.unitypackage to the project.
  3. After importing process had been completed, I've seen the error from UniGLTF.UniGLTFPreference:CreateProjectSettingsProvider() as descibed above.
  4. When I've fixed the above error, I also seen the error from VRM.VrmPreference:CreateProjectSettingsProvider() as descibed above.

Expected behavior

UniVRM package works without error.

Environments (please complete the following information):

  • OS: Windows 10
  • Unity version: Unity 2021.1.12f1
  • UniVRM version: UniVRM-0.77.0_4a14.unitypackage

Additional context

For now, I've fixed this issue with the following ad-hoc changes:

            var provider = new SettingsProvider("Preferences/UniGLTF", 
-               SettingsScope.User, SettingsProvider.GetSearchKeywordsFromGUIContentProperties<Styles>());
+               SettingsScope.User/*, SettingsProvider.GetSearchKeywordsFromGUIContentProperties<Styles>()*/);
            var provider = new SettingsProvider("Preferences/VRM0", 
-               SettingsScope.User, SettingsProvider.GetSearchKeywordsFromGUIContentProperties<Styles>());
+               SettingsScope.User/*, SettingsProvider.GetSearchKeywordsFromGUIContentProperties<Styles>()*/);
@ousttrue ousttrue added this to the v0.78 milestone Jun 22, 2021
@ousttrue
Copy link
Contributor

I tried it with unity-2021.1.12f1 and it didn't cause the same problem. Another issue # 1066 has occurred and has been fixed. Check if there is still a problem with v0.78.0.

@ousttrue ousttrue modified the milestones: v0.78, v0.79 Jun 23, 2021
@t-mat
Copy link
Author

t-mat commented Jun 23, 2021

Thank you for taking care of this issue.

I tried UniVRM-0.78.0_851b.unitypackage with the new blank project of Unity 2021.1.12f1. But unfortunately, it outputs same error to the console as I've reported.

(edit) Since this issue doesn't happen in your environemnt, I'm checking my Unity Editor environment.


I don't mean to review the code, but it seems SettingsProvider.GetSearchKeywordsFromGUIContentProperties<Styles>() doesn't return any meaningful keyword.
Because in this case, Styles refers UnityEditor.Graphs.Styles. As for Unity 2020.3 and 2021.1, I think it doesn't contain any human readable GUIContent.

I've also confirmed it with the following change to UniGLTF.UniGLTFPreference. UnityEditor Menu > Edit > Preferences will invoke [SettingsProvider].

#if UNITY_2019_1_OR_NEWER
        [SettingsProvider]
        static SettingsProvider CreateProjectSettingsProvider()
        {
+           foreach(var keyword in SettingsProvider.GetSearchKeywordsFromGUIContentProperties<Styles>()) {
+               Debug.Log($"keyword=<{keyword}>");
+           }
            var provider = new SettingsProvider("Preferences/UniGLTF", 
            ...

@ousttrue
Copy link
Contributor

I will remove the argument from the SettingsProvider

@ousttrue
Copy link
Contributor

v0.79.0

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

2 participants