Skip to content

Commit

Permalink
fix: namespace is too long
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Jul 22, 2024
1 parent 1da0d46 commit 9fa71b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Packages/src/Editor/UnityEventDrawerEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static void DrawDelegate(Rect position, Delegate del)
}
else if (target != null)
{
EditorGUI.LabelField(r, string.Format("{0} ({1})", target.ToString(), target.GetType()), EditorStyles.miniLabel);
EditorGUI.LabelField(r, GetNameWithoutNameSpace(target.GetType()), EditorStyles.miniLabel);
}
else
{
Expand All @@ -163,14 +163,19 @@ private static void DrawDelegate(Rect position, Delegate del)
// Draw the method name.
r.x += r.width;
r.width = position.width - r.width;
EditorGUI.LabelField(r, method.ReflectedType + "." + method.Name, EditorStyles.miniLabel);
EditorGUI.LabelField(r, GetNameWithoutNameSpace(method.ReflectedType) + "." + method.Name, EditorStyles.miniLabel);
}
catch
{
EditorGUI.LabelField(position, "null delegate", EditorStyles.miniLabel);
}
}

private static string GetNameWithoutNameSpace(Type type)
{
return type.FullName.Substring(type.Namespace.Length + 1);
}

/// <summary>
/// Gets the runtime call list from SerializedProperty.
/// </summary>
Expand Down

0 comments on commit 9fa71b1

Please sign in to comment.