mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix(SyncObjectCollectionField): Pretty SyncCollection Name (#3808)
* fix(SyncObjectCollectionField): Pretty SyncCollection Name * char typo * backward compatibility * Use RegEx.Replace
This commit is contained in:
parent
4a1be60ad7
commit
9e7b82135c
@ -4,6 +4,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Mirror
|
||||
@ -18,7 +19,12 @@ public SyncObjectCollectionField(FieldInfo field)
|
||||
{
|
||||
this.field = field;
|
||||
visible = false;
|
||||
label = $"{field.Name} [{field.FieldType.Name}]";
|
||||
|
||||
// field.FieldType.Name has a backtick and number at the end, e.g. SyncList`1
|
||||
// so we split it and only take the first part so it looks nicer.
|
||||
// e.g. SyncList`1 -> SyncList
|
||||
// Better to do it one time here than in hot path in OnInspectorGUI
|
||||
label = $"{field.Name} [{Regex.Replace(field.FieldType.Name, @"`\d+", "")}]";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user