[Bug][Expandable] Will make other expandable element which in front of this Attirbute not update
See original GitHub issueHere’s the code that reproduce the bug:
public class ExpandableTest : MonoBehaviour
{
public UnityEvent onClick;//Bug: the List can't be modify
[ResizableTextArea]
public string multiLine;//Bug: the content can't be save after hit 'Enter'
[Expandable]
public ScriptableObject obj0;
}
When you edit the onClick/multiLine field in Inspector, you will find that their value will not get save:
But if you move the obj0 on top of the onClick/multiLine field, they will work again.
Unity Version: 2021.2.7f1c1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Make absolute positioned div expand parent div height
You answered the question yourself: I know that absolute positioned elements are removed from the flow, thus ignored by other elements.
Read more >Expandable Sections Within a CSS Grid
I'm quite comfortable wrangling CSS Grid to produce interesting layouts, while keeping the HTML markup clean and simple. But recently, I was ...
Read more >Creating a Textarea with dynamic height using React and ...
Introduction. In this article, I'll show you how to create a <textarea> that automatically grows and shrinks depending on the content within.
Read more >Sheets: bottom
Expanding bottom sheets provide a small, collapsed surface that can be expanded by the user to access a key feature or task. They...
Read more >Advanced layouts with absolute and fixed positioning
Absolutely positioned elements are removed entirely from the document flow. That means they have no effect at all on their parent element or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have discovered that if you remove this line the issue goes away.
https://github.com/dbrizov/NaughtyAttributes/blob/178959b4f9ded9aead6cd1f9a80decf41b9b6812/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs#L74
My guess is that when the drawer is called on the blur event this code will somehow reset the value on the main inspector object before it has a chance to commit the changes via the final call to
ApplyModifiedProperties
here:https://github.com/dbrizov/NaughtyAttributes/blob/178959b4f9ded9aead6cd1f9a80decf41b9b6812/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs#L133
Why this is affecting the main object is not clear to me though, presumably some subtlety of other changes in the problematic commit.
Actually I see no issue with line removed. I assume the purpose of this line is to ensure that the nested editor is in sync with the asset. I tested this by opening a second inspector and modifying the nested asset there. Regardless of the presence of this line the asset will update correctly as soon as the mouse enters the inspector of the object with the
Expandable
attribute.Looking at the docs we see:
source: https://docs.unity3d.com/ScriptReference/SerializedObject.html
This suggests to me that this line is not required as the
SerializedProperty
reference appears to be recreated on every invocation ofOnInspectorGUI
.I will open a PR with this simple change.
#295 PR merged into the v2 branch 7cddf69bca9d09eb8205498ebaf6bdc50f7641fd