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"

Communicate between two widgets

I have two widgets. I want to send a value on from Widget A to Widget B. I have tried using Event Dispatchers, creating Custom Events, and Casting too. Casting and Event Dispatchers fail with an error "Accessed none trying to read property" Then I tried creating a custom event with an input variable, but it does not give any output. alt text

Note: I have created a function override "OnMouseButtonDown" to feed value to my custom event or the event dispatcher. alt text

I am following this tutorial https://www.unrealengine.com/en-US/tech-blog/creating-a-data-driven-ui-with-umg to create a widget that contains information from a data table. I want to get information displayed in my main widget when I click an item. Please open the link so that you can have an idea of what I am trying to do if I am not able to explain well.

My problem is that I can't send a variable value from one widget to another by using custom events, event dispatchers or casting. Maybe I am not setting up the targets properly or I am missing something very silly.

Product Version: UE 4.21
Tags:
2.jpg (507.4 kB)
1.jpg (551.7 kB)
more ▼

asked Jan 23 '19 at 05:53 AM in Blueprint Scripting

avatar image

Avi Aggarwal
1 1 2 3

avatar image M.FatihSaglam Jan 23 '19 at 09:34 AM

You can use BlueprintInterfaces

You can find various tutorials on YouTube about Interfaces as well.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

There's a valuable piece of information which I don't believe you've taken from the example provided, the fundamental portion of how the widgets are created.

You have a master widget (shop) that populates the contents (items) based off of data (data table).

The concept is simple. You create a widget that will create widgets. So your shop widget is the thing you are adding to the viewport. When it gets constructed, you trigger the creation of widgets for the shop items. That means, your master widget (shop) has access to the individual widgets one at a time (items) as they are being created and can pass forward information to them via variables which are set to "expose on spawn".

Whenever you have variables set to be "exposed on spawn", you can set them whenever your object gets created in code. For your purposes, you would be passing forward the information of price / picture / etc via the creation of an item widget.

more ▼

answered Jan 24 '19 at 08:46 PM

avatar image

MajinSephiroth
1.2k 31 8 32

(comments are locked)
10|2000 characters needed characters left

To share the content between two widgets, you can use Game Instance Blueprint. Create your own game Instance, set up variables and share.

more ▼

answered Feb 07 '19 at 08:11 PM

avatar image

Harsh Bakshi
5 1

(comments are locked)
10|2000 characters needed characters left
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