-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
[ReadOnly] does not work on ScriptableObjects in NaughtyAttributes 2.x, used to in 1.x. #113
Comments
Must be my mistake - you are correct; I didn't account to the possibility of us changing the type of the field at some point in between the version changes and it does seems like it's a [System.Serializeable] type class with a CustomInspector of its own. And I just found your main page documentation on this:
I'll test this right away! |
Wait, does that workflow even apply for [CustomPropertyDrawer]s in Editor/ folders? The CustomPropertyDrawer I have seems unable to reference NaughtyAttributes namespace, and it's inheriting from UnityEditor.PropertyDrawer not Editor so even if I could reference it, NaughtyInspector/UnityEditor.Editor would not be a suitable replacement. Any suggestions? At this moment this Issue is no longer named to describe the actual problem which would now be: "Need a [CustomPropertyDrawer] workaround similar to inheriting NaughtyInspector on custom Inspectors" |
You have an Editor or a CustomPropertyDrawer for your scriptable object? |
CustomPropertyDrawer. |
In that case [ReadOnly] should work, because It's also implemented with a CustomPropertyDrawer which targets all fields with the [ReadOnly] attribute. I need to investigate this. |
Do you apply the [ReadOnly] attribute to the ScriptableObject property, or you are using the [ReadOnly] attribute for the properties inside the ScriptableObject? |
Apologies, I seem to be changing the description constantly - I'm getting mixed up in changes in our codebase. I realise that must've wasted some of your time since I can't now find the CustomPropertyDrawer issue examples I was talking about... It seems to be a List and one List where X is a System.Serializable class, and that List is in a ScriptableObject. I'm trying to double-check and clarify here now. [ReadOnly]+[CustomPropertyDrawer] DO seem to work. Again, my apologies for the hassle. Some examples that don't seem to work with [ReadOnly]: Case, List on ScriptableObject
Another case, List<System.Serializable class> on ScriptableObject:
So it seems to be List that is the issue, not what I panicked about initially. |
Aaand further than that - seems the issue was only troubling where I was looking at EMPTY Lists! |
I have a couple of ScriptableObjects where the [ReadOnly] attribute was handy for some ScriptableObjects, blocking user intereference with some fields I only wanted to view for debug in the Inspector when selecting these ScriptableObject Assets.
After upgrading to 2.0.1, the [ReadOnly] no longer does anything to disable the fields as it used to.
Both versions 1.0.3 and 2.0.1 of NaughtyAttributes tested in Unity 2019.3.0f5.
The text was updated successfully, but these errors were encountered: