First, note that you can build your array using the Inspector:
export var arr = ["obj_1", "obj_2"]
You'll be able to change the variable type in the inspector.
Then, you will have to loop in your array using while or for.
#loop in arr
var i = 0
while i < arr.size():
#Access func
arr[i].func_name()
#Acces or change var
arr[i].var_name = 1
#Then iterate to avoid infinite loop!!
i+=1
- First be sure they all have the same scripts, or at least the same func name!
- Looping in large array and accessing their funcs can get your game laggy
- Avoid death loops! (Always add i+=1 in the loop)