Announcement

Collapse
No announcement yet.

Problem with UMG and Updating Text/Numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem with UMG and Updating Text/Numbers

    i have been getting this really strange problem and i cant figure it out. I want the text on my UMG Widget to update at a specific point, which i already have setup and is working, however, when it updates the text, the it seems that there is a second text of the old/first text behind the new updated text. It is also occurring on a Text label that i am not even changing (not editable). Here is what i am trying to explain.

    Click image for larger version

Name:	428120be07e7a6111e1e0df829a3d80b.png
Views:	1
Size:	2.5 KB
ID:	1152046

    Click image for larger version

Name:	1c05b304d80d7c4879b9f2916484d823.png
Views:	1
Size:	3.4 KB
ID:	1152047

    Its the number which i am trying to increment, and its the ''Wave:'' which is constant, but used to do the same thing as the number, but just with the same ''Wave:" text, but i cant seem to reproduce that problem (with the wave text) since/after i changed some things around that i cant remember. I want the "Wave:" To stay the same always, but the wave number('WaveText' variable) to increment what told to do so (which i believe i have working), at this point i am just assuming its either a bug or something i am doing wrong (probably that). ((Also i turned off the shadow on the text as that is what i initially thought it might be??)) Here is what i have for the blueprint of it.

    Click image for larger version

Name:	98d8005dbded211e54d1c65534a4fd99.png
Views:	1
Size:	72.6 KB
ID:	1152048

    Click image for larger version

Name:	0b5277ab629dcf24455217db8c0e6980.png
Views:	1
Size:	70.9 KB
ID:	1152049

    Click image for larger version

Name:	1541270fa3a34658e608d52dfd47f91c.png
Views:	1
Size:	150.9 KB
ID:	1152050

    Click image for larger version

Name:	07f49af1d764cf7f7edf271cda218eee.png
Views:	1
Size:	27.4 KB
ID:	1152051

    Click image for larger version

Name:	cea96d4474b1dd2207dbd978d500f930.png
Views:	1
Size:	129.3 KB
ID:	1152052

    Thank you!

    #2
    Bind your text var directly to hud's WaveText widget.

    Click image for larger version

Name:	img.png
Views:	1
Size:	126.1 KB
ID:	1080172

    Setting your plain text var from anywhere will automatically update the widget the var is bound to.

    See if it helps.

    Comment


      #3
      Thanks for the help, however now the number text is no longer updating, but the ''Wave:'' is doing what i couldnt remember how to recreate, which is sort or creating a copy of the text behind it.
      Click image for larger version

Name:	ce68befe5fbb06dfea6d2b3290dc409b.png
Views:	1
Size:	2.2 KB
ID:	1080175
      Here is what i did in case i set it up wrong.

      Click image for larger version

Name:	5d7d23f7df1b80b900584a0a060ac6f1.png
Views:	1
Size:	22.5 KB
ID:	1080176

      Click image for larger version

Name:	2bf417da46cbaa6bbaa0283e673cef37.png
Views:	2
Size:	104.2 KB
ID:	1080177

      Click image for larger version

Name:	b9b975cbdb5382d79c8193bfdfb20b86.png
Views:	1
Size:	58.3 KB
ID:	1080178

      Thanks.

      Comment


        #4
        I assume because everytime you construct the widget its setting the text. How many times are you constructing it during runtime? Just once? SetText is a way of setting a textblock from another class, its the improper way to do things IMO. You should have 2 text blocks in something like a horizontal box and set the second one texts' bind to a new function which returns the value you want. Then contruct the widget and it will constantly show the value.

        Hees an example of a binding that sets a text block to an item name from a structure.

        Click image for larger version

Name:	aFEa7HO.png
Views:	1
Size:	251.3 KB
ID:	1080197
        Last edited by Nsomnia; 06-20-2015, 05:21 PM.
        Tek LLC a personal Candaian Company running BlenderTek & UnrealTek is currently looking for help to bring back submarine simulator gaming with a new genre of sub sims: Cold War! (1945-1991) Operation: Trident SubSim Dev Diary Thread - Donations

        Comment


          #5
          Nsomnia's method (and the camelback Hungarian notation) makes perfect sense - that's the pro way; it might complicate things a little if you need to set 50+ text fields and does require extra work.

          At least get rid of this (in the constructor as well) and make sure you spawn the widget only once. I am under the impression you do it in a loop and end up with overlapping text.
          Click image for larger version

Name:	img.png
Views:	1
Size:	105.5 KB
ID:	1080220

          Also, from version 4.7 (I think) you can bind a string and text variable directly if it's a part of a struct, even if it sits in a struct of a referenced object.
          Attached Files

          Comment


            #6
            Thank you for this, it is no longer doing the duplicating of the text, however now as soon i start the level, the text increments fast and immediately (like up to 150 in 2 seconds), whereas i want it to just add 1 only once and only when i call it to do so from a different blueprint. Any ideas? This is my blueprint function.

            Click image for larger version

Name:	08e0add4ad9555ca311fb011f3924ad9.png
Views:	1
Size:	148.5 KB
ID:	1080291

            And how i am calling it to update.

            Click image for larger version

Name:	1dd794fc61a61e7389ddafe64d23cc9a.png
Views:	1
Size:	100.6 KB
ID:	1080292

            Thank you.

            Comment

            Working...
            X