Skip to content

Commit 117a2c4

Browse files
committed
If it was a GenericType, change it to extract the type information.
1 parent 9703098 commit 117a2c4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/TypeMenuUtility.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ public static string[] GetSplittedTypePath (Type type)
2424
}
2525
else
2626
{
27-
int splitIndex = type.FullName.LastIndexOf('.');
27+
// In the case of Generic, type information is included as shown below, so it must be extracted.
28+
// TestNamespace.TestClass`1[[UnityEngine.GameObject, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
29+
var name = type.IsGenericType ? type.FullName.Substring(0, type.FullName.IndexOf("[")) : type.FullName;
30+
31+
int splitIndex = name.LastIndexOf('.');
2832
if (splitIndex >= 0)
2933
{
30-
return new string[] { type.FullName.Substring(0, splitIndex), type.FullName.Substring(splitIndex + 1) };
34+
return new string[] { name.Substring(0, splitIndex), name.Substring(splitIndex + 1) };
3135
}
3236
else
3337
{

0 commit comments

Comments
 (0)