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"

Sending a string from a actor blueprint to a widget

Hello,

So I have been trying to create a digital watch for my character to wear and I have set up a working day and night system with a timer that counts hours, minutes and seconds which is saved in a string which displays HH:MM:SS.

I need to try send this string to a widget that will attach to the players watch so you can see the time when looking at the wrist (or on clocks ect).

I have tried to reference the blueprint within the widget which turned out a "accessed none error".

It wont be attached the the HUD like what most tutorials show since it will be a 3D widget attached to the characters wrist or to a clock mesh.

I have created a text box within the widget and then bind to it, but I am lost from there. What would be the best way to tackle this problem? It may be a simple issue but for the life of me I cant sort it.

Thank you.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 02 '16 at 02:08 PM in Blueprint Scripting

avatar image

jamiefeatures
8 1 4

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

1 answer: sort voted first

Okay, I have been working with widgets for a couple of days and I can tell you how I did it. However I'm a newbie, so there might be simpler solutions.

First you need to store your Widget right after creating it in a variable (your Widget's class name, not the Widget class) to be able to access its public functions later. Then, inside your Widget, you create a String variable and a public function, which sets the variable to the function's input (which is also a String variable). Then you can call this function from the actor you saved the Widget as a variable in earlier, passing the desired String to the String variable inside your Widget - there you can access it.

Note: If the actor that spawns the widget is not the same actor which has the string you want to pass, it might get even more complicated.

Hope this helps!

more ▼

answered Aug 02 '16 at 05:46 PM

avatar image

solvenga_gd
46 1 4

avatar image jamiefeatures Aug 02 '16 at 07:43 PM

Thank you for your reply.

I have just tried the above (or at least what I think is correct from above), I have the issue that when I try to reference the actual widget i get the "access none trying to read..." error.

I might be doing it wrong of course and I will keep tackling it. If anyone could post a image demonstration of this method, I would be highly appreciative.

Thanks again.

avatar image solvenga_gd Aug 03 '16 at 04:20 PM

Have you tried "connecting" those before adding them to viewport? Create widget -> pass the reference to the widget -> add widget to viewport.

avatar image jamiefeatures Aug 04 '16 at 03:41 AM

Thank you, I got it working without the error now and I can get it to appear on the viewport.

My issue now is that in the the 3d widget blueprint, when it is placed my character blueprint, the string doesn't appear and the text just disappears, since i need to attach this blueprint to my characters wrist, it's important that it works. Do I need to make it refresh in the blueprint somehow?

Sorry for all the questions, you have been extremely helpful thus far!

avatar image solvenga_gd Aug 04 '16 at 09:55 AM

Glad you got it working. As I said, I'm just recently started to learn UE myself - it just so happened that I have already been passing information from widgets to actors and vice versa, so I decided to share the way I do it. However, my widgets are GUI that is just sitting in the viewport and I have not been trying to attach them to objects yet, so I don't think I can help you there. I hope you'll figure it out! :)

avatar image jamiefeatures Aug 04 '16 at 11:45 AM

Ah, I understand. You have been a great help! Thank you again!

(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