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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Reference Variable from seperate blueprint

I looked at other questions, and I think im simply overlooking something here. Following the Inventory UI with UMG tutorial, and in video 5 the author says its best to store the inventory on the character controller as opposed to the UI (which makes sense) but for the sake of simplicity and the tutorial, he just places the inventory on the UI instead. But I decided it would be a fun little project to figure out.... Well, trial and error has not been kind. So, the basic setup is I have the First Person Controller BP that has an 'Editable' array called Inventory (made up of structs). I create 2 empty elements in it. Then in my UI script, I try to get a reference to the Inventory variable. I can get a reference to the First Person Character and save that as a variable, but for some reason I cant seem to pull the Inventory variable from it. Here is an image (this is within my UMG BP). alt text

I know I'm probably making a noob mistake here, but I just cant seem to figure it out. Im too used to actual coding and not the visual approach. Also, is this even the correct way to do this. I can get a reference to the inventory here, but is it an actual reference or just a copy. Meaning, will any changes I make to this reflect back to the original BP script, or do I have to create another function that will save the changes back to the original.

Image of how its setup in the controller alt text

Product Version: UE 4.10
inventory2.png (261.1 kB)
more ▼

asked Jan 01 '16 at 04:24 AM in Blueprint Scripting

avatar image

1 1 1

avatar image SterlingY Jan 01 '16 at 05:20 AM

Can you post a screenshot of how you have it set up in your character BP?

avatar image comprodigy Jan 01 '16 at 06:05 AM

Added a picture

avatar image SterlingY Jan 01 '16 at 06:22 AM

For starters, it doesn't look like you are adding anything to the Inventory Array. Also, if you reference the specific inventory array, then you should be able to write to it.

Maybe I'm a bit confused, but the UMG looks like it is taking the controller BP inventory array and setting another (local to UMG) inventory array. Changing the local one will not change the referenced array.

Maybe it would be clearer if I knew what the two SET nodes were setting specifically.

avatar image comprodigy Jan 01 '16 at 06:31 AM

I have a local variable on the UMG blueprint called Inventory as well (I know, my naming convention isnt the greatest). So im trying to grab the inventory from the player controller blueprint, and set it in the UMG bluesprint. The other set is setting another variable to the character reference itself (to get stats).

avatar image SterlingY Jan 01 '16 at 06:48 AM

So now I'm further confused. I thought you wanted to change the character BP Inventory from the UMG BP

avatar image comprodigy Jan 01 '16 at 07:22 PM

That is my ultimate goal, but for now im just trying to figure out why I cant pull the inventory variable from the character controller to the UMG script. Once I get that figured out I can work on getting a reference or just updating the inventory manually.

avatar image SterlingY Jan 01 '16 at 07:28 PM

How do you know you're not getting the Inventory from the Character BP? You still have to get an element from the array, or have you tried that and didn't get anything? Have you tried to log the contents of the array?

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

1 answer: sort voted first

I'm having the same issue. I've been using print string in between execution steps to see where the information is lost. Within the character BP, the array is created and has elements added correctly. It does appear that as soon as the script in the UMG blueprint begins, the array is empty. As SterlingY suggested, the UMG BP does seem to be making a local array unrelated to the character BP array. Any solutions would be appreciated.

more ▼

answered Sep 28 '16 at 03:45 AM

avatar image


(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