I’ve been writing a custom Editor script and I recently have been trying to make it work with Menu items which works fine. It places all required scripts as a child of the Editor based Script RPGQuickStarter- > AllRequireScripts
I’m getting an odd error when I try to load the Parent Editor script. It constantly gives me errors when it tries to load up initially and I narrowed the problem down to loading GUIStyles correctly.
I’m editing the GUIStyles properties individually… Background image, font color etc. My editor works completely fine if I go and maximize the AllRequiredScripts child and actually click on it once… Otherwise it never gets beyond me “Please Wait While scripts are being found…” debug message.
This error only occurs with the GUIStyles anyone have a work around or any idea why this is happening?
You may need to contact the maker of RPGQuickStarter directly.
You have not specified the errors being given (post them), nor have you shown any code that is causing these errors, meaning it would require someone psychic to know you are doing, what the script expects, and why it is throwing whatever error it’s throwing.
I am the creator. As I stated I’m writing this Editor
NullReferenceException: Object reference not set to an instance of an object
InventoryEditor.OnInspectorGUI () (at Assets/Scripts/Inventory/Editor/InventoryEditor.cs:102)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
UnityEditor.InspectorWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
This error is probably not going to help anyone. As I also said I narrowed it down to the Styles not being loaded Properly with the Editor. Everything else works completely fine except for the Styles.
This is a piece that will cause an error con.BagStyle.alignment = (TextAnchor) EditorGUILayout.EnumPopup("Label Alignment ", con.BagStyle.alignment);
But it only causes this error on Initial load up. If I go and look at the scripts in the child it works completely Fine…
Are you serializing styles to a GUISkin? Or just a scriptable object/monobehaviour?
One thing i’ve noticed with GUISkin, its not like Vector3 or other value types shown in inspector. But it is shown similarly. Its quite posible that it maybe null on instantiation.