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"

Totally at a loss, unable to access struct from another blueprint

Using 4.8.2

This seems insane, no matter how hard I debug, nothing works. I have a Blueprint called BP_Mercury, which is trying to access the member of a struct in BP_SUN so that it can get the mass... But nothing works. I've tried casting, I've tried using a variable set as the target blueprint, but NOTHING I do seems to work. I cannot seem to extract the value of the other blueprint's struct no matter what I try. This is how the blueprint is defined.

From CelestialBody UClass:

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "OrbitData")
     FavBodyInfo cbBodyInfo;

This is the struct:

 USTRUCT(BlueprintType)
 struct FavBodyInfo
 {
 GENERATED_USTRUCT_BODY()

     //Define Mass, Size, Atmosphere, Composition, Etc
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Body Properties")
     float Mass;
 }

If I break the struct from Self and Print to screen, it shows the mass. If I reference an external object, it always comes back as zero. Here's my attempts to debug with print statements (which always show a 0.0 value no matter what I set.)

alt text

I'm so so confused. It always shows the Parent Body's Mass as zero.

Product Version: UE 4.8
Tags:
bp_noworky.png (246.0 kB)
more ▼

asked Jul 22 '15 at 05:53 AM in Blueprint Scripting

avatar image

iontom
21 2 4 5

avatar image RAVaught Jul 22 '15 at 06:04 AM

Could post screenshots of the other related BP's. Structs are a little finicky. It would help to see where values are being accessed/set. One thing that stands out is that you are not casting your ParentSelect>target, but accessing the struct directly.

avatar image theonecalledtom Jul 22 '15 at 03:33 PM

Any warnings in the output about accessing null objects?

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

1 answer: sort voted first

Firstly, try create constructor in your struct:

 FavBodyInfo
 {
     Mass = 0;
     Radius = 0;
 }

Secondly, define class like this:

 USTRUCT(BlueprintType)
  struct [YourGameName]_API FavBodyInfo

If none of this helps, then it is a bug, or some mistake in your blueprint. I can continue this answer, if you show where and how you are modifying ParentSelect variable (if there will be something wrong of course).

more ▼

answered Jul 25 '15 at 07:29 PM

avatar image

HungryDoodles
495 29 24 40

(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