Skip to content

Commit

Permalink
com.utilities.extensions 1.1.10 (#18)
Browse files Browse the repository at this point in the history
- fixed bug where it was impossible to add initial element into dictionary
  • Loading branch information
StephenHodgson authored Aug 16, 2023
1 parent 40869eb commit c770f3c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion Editor/PropertyDrawers/SerializedDictionaryObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ internal bool CanAddNewItem()
{
if (IsNull()) { return false; }

UpdateSerializedObject();
var items = ToList();

foreach (var (key, _) in items)
Expand Down
3 changes: 2 additions & 1 deletion Editor/PropertyDrawers/SerializedDictionaryPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void OnValueDrawElementCallback(Rect rect, int index, bool active, bool focused)

float OnValueElementHeightCallback(int index) => OnListElementHeightCallback(index, serializedDictionary);

bool OnValueOnCanAddCallback(ReorderableList _) => serializedDictionary.CanAddNewItem();
bool OnValueOnCanAddCallback(ReorderableList _) => serializedDictionary.size == 0 || serializedDictionary.CanAddNewItem();

void OnValueOnAddCallback(ReorderableList reorderableList)
{
Expand Down Expand Up @@ -64,6 +64,7 @@ void RemoveCallbacks(ReorderableList orderedList)

if (!reorderableListCache.TryGetValue(serializedDictionary.guid, out var list) ||
list.count != serializedDictionary.size ||
serializedDictionary.size == 0 ||
serializedDictionary.IsNull())
{
if (list != null)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Utilities.Extensions",
"description": "Common extensions for Unity types (UPM)",
"keywords": [],
"version": "1.1.9",
"version": "1.1.10",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.extensions#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.extensions/releases",
Expand Down

0 comments on commit c770f3c

Please sign in to comment.