Skip to content

Conversation

@YuukiARIA
Copy link
Contributor

After reloading scripts, selecting SpringBonePivot objects before selecting any other components (SpringBoneManager, SpringBone, ...) causes NullReferenceException.

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:394)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:385)
UnityEngine.GUILayout.DoButton (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:36)
UnityEngine.GUILayout.Button (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:32)
Unity.Animations.SpringBones.SpringBonePivotInspector.OnInspectorGUI () (at Library/PackageCache/com.unity.springbone@8e3a105546/Editor/GUI/Inspectors/SpringBonePivotInspector.cs:16)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at /Users/bokken/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:527)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)

It seems that SpringBoneGUIStyles.ButtonStyle is not initialized.
To fix this, simply add calling SpringBoneGUIStyles.ReacquireStyles() before drawing the inspector.

@H3idi-X
Copy link
Contributor

H3idi-X commented Oct 15, 2021

Thank you for the PR, We have reproduced the issue following the procedure you reported and confirmed that your PR fixes it. Thank you very much for your corporation.

@H3idi-X H3idi-X merged commit e6a5df3 into unity3d-jp:dev/main Oct 15, 2021
@YuukiARIA YuukiARIA deleted the fix-spring-bone-pivot-inspector-null-ref branch October 15, 2021 15:27
H3idi-X added a commit that referenced this pull request Oct 16, 2021
* Add localization and make default language to English

* update package version and supported Unity version due to localization support

* fixed assembly issue during build

* Add conditional localization import

Localization API moved in 2020.1 and 2020.2

* Mark v1.2.0-preview.0 (unlikely name)

* Adjust version to 1.2.1-preview.0

Technically based off 1.2.1-preview, but package manifest originally listed 1.2.0-preview

* Consider model scale (#11)

Even if the model is scaled, the size of the gizmo will not be scaled. So you can't set the collision.
This change will take scale into account and fix it to work correctly.

* Call SpringBoneGUIStyles.ReacquireStyles() on SpringBonePivotInspector (#12)

* Updated CHANGELOG.md package.json
Added upm-ci

* Re-added some to  CHANGELOG.md.

* Updated upm-ci file to check web-hook on GitHub.

* updated upm-ci-SpringBone.yml

* Set up tentative enviroment just to make the project can pass yamato-ci.test.

* Fixed: old mac build farm in upm-ci

* Added Tests.meta to avoid yamato-ci errors.

* added Tests.meta to .gitattribute

Co-authored-by: Hiroki Omae <[email protected]>
Co-authored-by: riina <[email protected]>
Co-authored-by: tyfkda <[email protected]>
Co-authored-by: YuukiARIA <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants