How to make a drift point system

I think I have an idea on how to do it an easy way but I dont know how to actually do it. how would I make a widget that displays numbers that go up depending on how long u hold space (which would be drifting) and then when you let go, after a few seconds have it restart.

Hey User-8fd0522d09,

You could check the.

“Your First Hour with UMG” on the Unreal Learning website.

I think this course will give you most of the answers.

It can be as simple as this:

Image from Gyazo

And if you wanted to convert Time to Points, you could do this:

Here, every second the Space Bar is held down for is worth 20 points.

I tried doing what you sent but im having issues compiling. thank you for the fast reply by the way

Look at what the target is for the node with the error - Player Controller. Get Player Controller and plug it in. The script I posted was already in the Player Controller (so Self was OK there) since it’s a great place to keep all the Input.

Also do store a reference to the widget - right click on the Return Value pin and promote.

everything is compiling but its not showing up in game
Do I have to add anything in the widget graph?

everything is compiling but its not showing up in game
Do I have to add anything in the widget graph?

No, there is no other script. Do you even see the widget on the screen? You’re doing it in the Game Mode - does the loaded level use this Game Mode?

Besides that, Game Mode is not supposed to handle player input. I don’t even know whether it can.

Input goes into the Player Controller or the Pawn. Consider doing it there, it’s the most natural / optimal place.

no i cant see the widget when the games loaded.
I also just moved it to the playerbp.
I feel like I’ve done something wrong with widget but im not sure

Its still not showing up i feel like i might have messed something up with the widget but its compiling now and i moved it all to my playerbp

The widget I used for this:

339027-screenshot-4.png

Ensure the widget’s Visibility is not set to Hidden or Collapsed.

Its still not showing

If in doubt:

  • do tell how the player gets into the world
  • show the widget hierarchy
  • show how it’s currently hooked up
  • do any other widget show up when you add them to viewport
  • is there anything special about the order in which the levels are loaded?

I dont think there is anything special about the order the levels are loaded and all my other widgets show up. if u have discord i could give u a closer look at it if u want

You create the widget via a Custom Event. What calls that event? If it’s not called, nothing is going to happen. Create the widget onBeginPlay or at least have it call that custom event. Or setup some logic that calls it.

That’s probably the reason why the widget is not showing - it’s never created and added to the viewport.

And you still have no widget reference set up - that’s going to bite you sooner than you expect. See one of my messages for details on how to set it up, namely:

Also do store a reference to the
widget - right click on the Return
Value pin and promote to variable.

See my comment at the bottom - do you actually call those events? Something needs to trigger them, right? If in doubt, put a Print String node and observe what triggers and what does not. Or debug with break points.

Other than that, you might have set the widget to be Hidden.

At this point, seeing how you struggle with even adding a widget to the screen, I want to side with Rene Zwaan’s suggestion.