jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

Not sure how to get this working in my project #138

Closed aitchest-of-dees closed 8 years ago

aitchest-of-dees commented 8 years ago

Howdy,

I'm trying to figure out how to use this for my MonoBehaviour scripts. Nothing new shows up in the inspector out of the box. I can get very simple things to work from the examples, like wrapping a Dictionary inside of a BaseObject, but I don't want to change all my objects in this way. Instead I tried changing a script from MonoBehaviour to BaseBehavior, and I'm getting errors on one of my scripts (I was able to get this to work on another script without errors).

Error 1 happens 1 time:

ArgumentOutOfRangeException: Cannot be negative.
Parameter name: length
System.String.Substring (Int32 startIndex, Int32 length) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/String.cs:348)
FullSerializer.fsTypeExtensions.CSharpName (System.Type type, Boolean includeNamespace) (at Assets/FullInspector2/Core/FullSerializer/Module/Assets/FullSerializer/Source/Internal/fsTypeExtensions.cs:67)
FullSerializer.fsTypeExtensions.CSharpName (System.Type type) (at Assets/FullInspector2/Core/FullSerializer/Module/Assets/FullSerializer/Source/Internal/fsTypeExtensions.cs:18)
FullInspector.Internal.fiReflectionUtility+DisplayedType..ctor (System.Type type) (at Assets/FullInspector2/Core/Editor/fiReflectionUtility.cs:31)
FullInspector.Internal.fiReflectionUtility.GetTypesDeriving (System.Type baseType) (at Assets/FullInspector2/Core/Editor/fiReflectionUtility.cs:79)
FullInspector.Internal.fiReflectionUtility.GetCreatableTypesDeriving (System.Type baseType) (at Assets/FullInspector2/Core/Editor/fiReflectionUtility.cs:49)
FullInspector.Internal.AbstractTypePropertyEditor.TryCreate (System.Type dataType) (at Assets/FullInspector2/Core/Editor/PropertyEditors/AbstractTypePropertyEditor.cs:116)
FullInspector.PropertyEditor.GetCachedEditors (System.Type propertyType, ICustomAttributeProvider attributes) (at Assets/FullInspector2/Core/Editor/PropertyEditor.cs:153)
FullInspector.PropertyEditor.Get (System.Type propertyType, ICustomAttributeProvider editedAttributes) (at Assets/FullInspector2/Core/Editor/PropertyEditor.cs:177)
FullInspector.Internal.fiEditorGUI.EditPropertyHeightDirect (FullInspector.InspectedProperty property, System.Object propertyValue, fiGraphMetadataChild metadataChild) (at Assets/FullInspector2/Core/Editor/fiEditorGUI.cs:361)
FullInspector.Internal.fiEditorGUI.EditPropertyHeight (System.Object container, FullInspector.InspectedProperty property, fiGraphMetadataChild metadata) (at Assets/FullInspector2/Core/Editor/fiEditorGUI.cs:372)
FullInspector.Internal.ReflectedPropertyEditor.GetElementHeight (UnityEngine.GUIContent label, System.Object element, FullInspector.fiGraphMetadata metadata) (at Assets/FullInspector2/Core/Editor/PropertyEditors/ReflectedPropertyEditor.cs:395)
FullInspector.PropertyEditorExtensions.GetElementHeight[Object] (IPropertyEditor editor, UnityEngine.GUIContent label, UnityEngine.Object element, fiGraphMetadataChild metadata) (at Assets/FullInspector2/Core/Editor/IPropertyEditorExtensions.cs:256)
FullInspector.DefaultBehaviorEditor.OnGetHeight (UnityEngine.Object behavior, FullInspector.fiGraphMetadata metadata) (at Assets/FullInspector2/Core/Editor/DefaultBehaviorEditor.cs:47)
FullInspector.BehaviorEditor`1[TBehavior].GetHeight (UnityEngine.Object behavior) (at Assets/FullInspector2/Core/Editor/IBehaviorEditor.cs:112)
FullInspector.IBehaviorEditorExtensions.EditWithGUILayout[Object] (IBehaviorEditor editor, UnityEngine.Object element) (at Assets/FullInspector2/Core/Editor/IBehaviorEditorExtensions.cs:17)
FullInspector.FullInspectorCommonSerializedObjectEditor.ShowInspectorForSerializedObject (UnityEngine.Object target) (at Assets/FullInspector2/Core/Editor/FullInspectorCommonSerializedObjectEditor.cs:177)
FullInspector.FullInspectorCommonSerializedObjectEditor.OnInspectorGUI () (at Assets/FullInspector2/Core/Editor/FullInspectorCommonSerializedObjectEditor.cs:193)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1162)
UnityEditor.DockArea:OnGUI()

Error 2 happens every frame.

InvalidOperationException: The chain contains no editors
FullInspector.PropertyEditorChain.get_FirstEditor () (at Assets/FullInspector2/Core/Editor/PropertyEditorChain.cs:90)
FullInspector.Internal.fiEditorGUI.EditPropertyHeightDirect (FullInspector.InspectedProperty property, System.Object propertyValue, fiGraphMetadataChild metadataChild) (at Assets/FullInspector2/Core/Editor/fiEditorGUI.cs:361)
FullInspector.Internal.fiEditorGUI.EditPropertyHeight (System.Object container, FullInspector.InspectedProperty property, fiGraphMetadataChild metadata) (at Assets/FullInspector2/Core/Editor/fiEditorGUI.cs:372)
FullInspector.Internal.ReflectedPropertyEditor.GetElementHeight (UnityEngine.GUIContent label, System.Object element, FullInspector.fiGraphMetadata metadata) (at Assets/FullInspector2/Core/Editor/PropertyEditors/ReflectedPropertyEditor.cs:395)
FullInspector.PropertyEditorExtensions.GetElementHeight[Object] (IPropertyEditor editor, UnityEngine.GUIContent label, UnityEngine.Object element, fiGraphMetadataChild metadata) (at Assets/FullInspector2/Core/Editor/IPropertyEditorExtensions.cs:256)
FullInspector.DefaultBehaviorEditor.OnGetHeight (UnityEngine.Object behavior, FullInspector.fiGraphMetadata metadata) (at Assets/FullInspector2/Core/Editor/DefaultBehaviorEditor.cs:47)
FullInspector.BehaviorEditor`1[TBehavior].GetHeight (UnityEngine.Object behavior) (at Assets/FullInspector2/Core/Editor/IBehaviorEditor.cs:112)
FullInspector.IBehaviorEditorExtensions.EditWithGUILayout[Object] (IBehaviorEditor editor, UnityEngine.Object element) (at Assets/FullInspector2/Core/Editor/IBehaviorEditorExtensions.cs:17)
FullInspector.FullInspectorCommonSerializedObjectEditor.ShowInspectorForSerializedObject (UnityEngine.Object target) (at Assets/FullInspector2/Core/Editor/FullInspectorCommonSerializedObjectEditor.cs:177)
FullInspector.FullInspectorCommonSerializedObjectEditor.OnInspectorGUI () (at Assets/FullInspector2/Core/Editor/FullInspectorCommonSerializedObjectEditor.cs:193)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1162)
UnityEditor.DockArea:OnGUI()
jacobdufault commented 8 years ago

Can you post the type that you have derived from BaseBehavior?

This looks like an issue with generating a human readable name for the type.

aitchest-of-dees commented 8 years ago

The type? It's just a class. Changed from:

public class PlayerPickerBaseScene : MonoBehaviour

to

public class PlayerPickerBaseScene : BaseBehavior

So far just this class has the error. I've done the same thing now with other classes and the others seem to work, except I can't see any properties that have getters/setters.

aitchest-of-dees commented 8 years ago

Ok, I think I figured out the problem. I had an object I was locking in that script. I seem to have made the object public by mistake. Changing it to private fixed the error. It just so happened that was the first script I tested Full Inspector out.

jacobdufault commented 8 years ago

If it's working, that's awesome.

I'm really curious about the CSharpName exception, since I've never seen it that method crash before. Can you post the entire PlayerPickerBaseScene class? Was PlayerPickerBaseScene in a namespace?

I seem to have made the object public by mistake. Changing it to private fixed the error.

I'm not quite sure what you mean by making the object public.

aitchest-of-dees commented 8 years ago

I mean it was

public object locky;

now it's

private object locky;

It was public by mistake. I'm pretty sure this code

lock(locky) { //code }

was the issue because it was a public property, Full Inspector was probably trying to get information about it, but the object was locked.

jacobdufault commented 8 years ago

Ok, I'm going to close this issue then. Please reopen or file a new issue if you run into any other problems.