Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Store Components In C++ Accessible Array

Sorry, the title isn't totally what I want, but I'll explain what I am trying to do. I am trying to store an array of structs containing a USceneComponent derived class reference and a float. I want to access that array in C++, but define it in blueprint. The USceneComponents are already attached to my blueprinted object, and I want to store references to them in the array along with their float data, but ideally I want to do this in Properties as default values.

I'd like to avoid setting each index in my construction script because it's a little harder to understand for others, and having it

My basic struct looks like:

 struct MyStruct
     UPROPERTY(Category = Sprite, EditAnywhere, meta = (DefaultValue = "1", ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"))
     float myFloat;
     UPROPERTY(Category = Sprite, EditAnywhere, BlueprintReadWrite, Instanced)
     USceneComponent* myComponent;
         : myComponent(nullptr)
         , myFloat(0.0f)

My array definition looks like:

     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Properties)
     TArray<MyStruct> myArray;

My scene component fields never show up in my array properties.

alt text

The alternative is to make a subclass of my USceneComponent derived class that also stores the float, which isn't the end of the world, but will require me to remake my existing components with the new derived types I think.

Product Version: Not Selected
myarray.png (3.7 kB)
more ▼

asked Apr 17 '15 at 07:49 PM in C++ Programming

avatar image

703 40 32 123

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hello Mrooney,

Giving the specifier BlueprintType as a parameter of the Ustruct macro will expose these properties in the editor.

Thanks, Daniel

more ▼

answered Feb 26 '18 at 10:31 PM

avatar image

Daniel U ♦♦ STAFF
205 2 5 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question