小沙盒工作室@Godot-StartUP 的内容(查看所有内容)
在Godot实现按照固定大小切割数组(分组)
小沙盒工作室
2022-10-06
https://godoter.cn/d/308-zai-godotshi-xian-an-zhao-gu-ding-da-xiao-qie-ge-shu-zu-fen-zu
extends Object
class_name ArrayUtils
static func split_array(array:Array, step:int) -> Array:
var output = []
for i in range(0, len(array), step):
var each = array.slice(i,i + step)
output.append(each)
return output
pass
(转发自:原日志地址)