Skip to content

Commit 6519e5e

Browse files
committed
feat(Util): Modernize merge arrays
1 parent 4da8c81 commit 6519e5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Assets/JCSUnity/Scripts/Util/JCS_Util.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,18 @@ public static int LoopIn<T>(int index, List<T> arr)
202202
/// <returns></returns>
203203
public static T[] MergeArrays<T>(params T[][] arrList)
204204
{
205-
if (arrList.Length <= 1)
206-
{
207-
JCS_Debug.Log("You trying to merge the array less then two array");
208-
}
205+
if (arrList.Length == 0)
206+
return null;
207+
208+
if (arrList.Length == 1)
209+
return arrList[0];
209210

210211
int arrLen = 0;
212+
211213
foreach (var arr in arrList)
214+
{
212215
arrLen += arr.Length;
216+
}
213217

214218
// first combine the first two array.
215219
T[] data = MergeArrays2<T>(arrList[0], arrList[1]);

0 commit comments

Comments
 (0)