x

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"

Passing USTRUCT() reference to Blueprint

How can I pass USTRUCT() reference from a C++ class to it's child blueprint? I have my USTRUCT() defined in a separate header.

In my AActor c++ class header I make a forward declaration on structure

     struct FSymbolInfo* SymbolProperties;

and in source file I actually include structure header and fill it's fields with data.

How can I access USTRUCT() data with a BP?

USTRUCT() is defined separately:

 USTRUCT(BlueprintType)
 struct TWODSIDESCROLLER_API FSymbolInfo
 {
     GENERATED_BODY()
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SymbolProperties")
         FString SymbolName;
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SymbolProperties")
         float SymbolLength;
 
         FSymbolInfo()
     {
 
     }
 };
Product Version: UE 4.10
Tags:
more ▼

asked Dec 16 '15 at 11:50 AM in C++ Programming

avatar image

Unteroid
74 12 17 24

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

1 answer: sort voted first

Hello Unteroid,

What exactly do you want to do with the reference when you get it to blueprint? You should be able to just create an variable of the struct's type and make that variable a UProperty. It'll then show up as one of the blueprint's properties and will reflect any data you've put into it.

You will run into issues if you try to create a UProperty of a UStruct with forward declaration along however. You'll need to include the file where this UStruct is being declared. This is due to how structs are parsed.

more ▼

answered Dec 16 '15 at 08:32 PM

avatar image Unteroid Dec 17 '15 at 06:39 AM

Making structure available with UPROPERTY() worked, weird I didn't try that. I didn't want to declare struct in header because I don't really like to pollute it.

I did want to make pointer to struct as UPROPERTY() and allocate memory later in the constructor as we do with components.

(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