Can't add elements to TArray
I'm creating a TArray and using it as a UPROPERTY. When I try to add any element it just doesn't work.
Is it because of the UPROPERTY? How can I make it?
I'm using this structure:
UPROPERTY(BlueprintReadOnly, EditAnywhere) TArray MyArray; MyArray.Add (TEXT("INSERT"));
asked Mar 08 '18 at 01:08 PM in C++ Programming
First UPROPERTY should be contain BlueprintReadWrite because thats mark that property as writeable from blueprint.. Long info about this: https://wiki.unrealengine.com/UPROPERTY
TArray's always should contain the type, for example
Final Code should be look like this in your .h file:
After this you can use YourArrayName.Add("TestString"); for example in your cpp file
Further info how you need to use TArrays: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/TArrays/
Follow this question
Once you sign in you will be able to subscribe for any updates here