Skip to content

Commit 0d0b263

Browse files
committed
fix: picker toString
1 parent 9f7b2c3 commit 0d0b263

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

Scripts/Runtime/Core/CollectionItemPicker.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.Text;
45
using UnityEngine;
56
using UnityEngine.Serialization;
67

@@ -352,5 +353,24 @@ public void OnAfterDeserialize()
352353
{
353354
isDirty = true;
354355
}
356+
357+
public override string ToString()
358+
{
359+
if (Items.Count == 0)
360+
return "[]";
361+
362+
StringBuilder builder = new StringBuilder();
363+
builder.Append('[');
364+
for (int i = 0; i < Items.Count; i++)
365+
{
366+
if (i > 0)
367+
builder.Append(", ");
368+
369+
TItemType item = Items[i];
370+
builder.Append(item != null ? item.name : "<null>");
371+
}
372+
builder.Append(']');
373+
return builder.ToString();
374+
}
355375
}
356-
}
376+
}

0 commit comments

Comments
 (0)