Skip to content

Commit c0e978d

Browse files
committed
feat(Util): Accept string for clone related functions
1 parent 8250d86 commit c0e978d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Assets/JCSUnity/Scripts/Util/JCS_Util.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,11 @@ public static void DestroyImmediateAllTypeObjectInScene<T>()
791791
/// </summary>
792792
public static bool IsClone(Object obj)
793793
{
794-
return obj.name.Contains("(Clone)");
794+
return IsClone(obj.name);
795+
}
796+
public static bool IsClone(string name)
797+
{
798+
return name.Contains("(Clone)");
795799
}
796800

797801
/// <summary>
@@ -800,9 +804,11 @@ public static bool IsClone(Object obj)
800804
/// </summary>
801805
public static string RemoveCloneString(Object obj)
802806
{
803-
obj.name = obj.name.Replace("(Clone)", "");
804-
805-
return obj.name;
807+
return RemoveCloneString(obj.name);
808+
}
809+
public static string RemoveCloneString(string name)
810+
{
811+
return name.Replace("(Clone)", "");
806812
}
807813

808814
#endregion

0 commit comments

Comments
 (0)