Material Box

Material Box

WEB Design & Material Images

Godot - Concatenate arrays

Godot

GDScript code example to concatenate arrays.


Can concatenate arrays using "+" operator in GDScript.\r
Using "+" operator returns a new array.

var array1 = ["apple", "lemon"]
	var array2 = ["banana", "pineapple"]
	var array3 = array1 + array2

	print(array3)
	# ["apple", "lemon", "banana", "pineapple"]

Can concatenate another array to existing array with append_array().\r
Using append_array() overwrites base array.

var array1 = ["apple", "lemon"]
	var array2 = ["banana", "pineapple"]
	array1.append_array(array2)

	print(array1)
	# ["apple", "lemon", "banana", "pineapple"]

Godot

TitleGodot - Concatenate arrays

CategoryGodot

Created

Update

AuthorYousuke.U