how do i put a list of items into my tarray?

in my header its
UPROPERTY(BlueprintReadWrite, Category = β€œConfig”)

im using this in my constructor: ArrayName.Add = (8, -8, 1, -1, 7, -7, 9, -9);

but he returns an error: β€œ=”: function as left operant.
whats wrong?


I think you can only add one item at a time so in your case it would be



hi majekpl maybe you must see basics of programming .Add is a method inside TArray for abvious reason cant be assigned
.Add is using like this myArray.Add(myobj) all method need some arguments if required check about object oriented programming and how to do a class from scratch
if you want use tarray costructor you need use like this myArray.Init()

You can read some useful things about TArray here:

If you want to populate an Array in one line, you can do this:

	TArray<uint8> ArrayName;
	uint8 SimpleArray] = {8, -8, 1, -1, 7, -7, 9, -9};
	ArrayName.Append(SimpleArray, ARRAY_COUNT(SimpleArray));

I hope this help you :slight_smile:

thanks alot it works! :slight_smile: