Hold 'E' To Interact | Time Dependant Progress Bar - Unreal Engine 4 Tutorial
Вставка
- Опубліковано 19 тра 2024
- Hey guys, in today's video, I'm going to be showing you how to hold a button to fire off code. For example, having to hold 'E' to interact with something. We will also be adding a visual progress bar on screen for the player to see. This will increase as the player holds the button.
#Ue4 #UnrealEngine4 #Ue4Tutorial
___________________________________________________________________________
00:00 - Intro
00:19 - Overview
01:10 - Tutorial
16:30 - Final Overview
16:50 - Outro
___________________________________________________________________________
Unreal Engine 4 Tutorials Playlist: • Unreal Engine 4 Tutorials
The Basics Of Nodes Playlist: • The Basics Of Nodes In...
Blender Tutorials Playlist: • Blender Tutorials
___________________________________________________________________________
If you enjoy make sure to subscribe: / @mattaspland
Join My Discord Server: / discord
Follow Me On Instagram: / matt_aspland_
___________________________________________________________________________
If you want to support me, you can PayPal me at "matt.aspland.1@gmail.com". This is by no means expected or required. It is just a nice support :)
Link to PayPal: www.paypal.com/
You can also support me on Ko-Fi following this link: ko-fi.com/mattaspland
Thank you :)
___________________________________________________________________________
♫Music By♫
●Kronicle - Chill Noons
●Soundcloud - / the-chemist-10
If anyone is having an issue with the widget not disappearing then do this: in your item BP add a "Do Once" between "Enable input" and "Create Widget" Then create a custom event and plug it in to the reset of the "Do Once". Trigger the custom event at the end of the code after the "Gate" and in-between the set "Is Held" and the "Close" on the Gate.
its working perfectly, but when i move away from the box and closer again the widget is not showing, what should i do, pls 😭
I swear every time I need something Matt already have it done
This is amazing man thank you so much for this tutorial 😭
Thank you massively man, so happy I could help! :)
Dude, I love your tutorials, keep it up, like actually
Thank you so much bro, that means a lot to me!
@@MattAspland I've been looking for a way to simulate NPCs similar to those from GTA V, like how when you throw a grenade the cars start driving like crazy and things like that, I feel like if you were to make tutorials or a video series teaching similar GTA mechanics that'd make your channel grow a lot my guy
@@techyspace5713 Yeah that sounds like a great idea man, cheers for the suggestions!
Matt, thanks for the tutorial. You always seem to save the day. I have an issue where the remove from parent doesn't seem to be working. I can walk away and the hud is still active. I'll look at it again later when I have time. I'm on a later version but that shouldn't make any difference.
Love your tutorials!
Thank you so much, I really appreciate it :)
If you're using UE5, be sure to add the Canvas Panel first
This is exactly what I was looking for to code a progress bar for my game, but a question: is there a way to implement non-standard progress bar movements to go with custom UI elements? For example, I want to add a circular progress bar that advances in a clockwise rotation, similar to the lockpicking interaction in Payday 2.
Hey Matt, great tutorial, any assistance with the following would be greatly appreciated!
Upon filling up the bar I dont want it to fill again untill you release and press E again, at the moment they can continually hold E and fill the bar but it doesnt always fire off the "destroy actor" section or in my case spawning another actor. Either fix to stop untill you press E again or a fix to keep spawning items when bar keeps filling up
Hi @Matt Aspland, first I just wanted to say thank you so much for your tutorials, you are really helping the dream of creating my own survival horror game, a reality.
I know this is super late, but my progress bar does not fill, everything else works perfectly.
The bar comes up on screen, but the visual of the bar filling up isn't working.
Any help or suggestions would be greatly, greatly appreciated. Thank you again for you awesome tutorials Matt.
Nice job!
Thanks Steve!
Hello Matt! First, thanks for this awesome tutorial. While it should work out of the box, I try to use it for a little different case and ran into a big problem. In detail, I just want to have the progress bar on my title screen (similar to games like Cyberpunk with the "Hold a button to start" and the progress bar fills up before any menu gets called. Problem in short: The progress bar won't update.
My setup:
- I actually have the progress bar inside a Widget BP that gets called with a Blueprint Interface at begin play inside a main menu controller (player controller)
- The whole function like seen in your video is build inside this player controller
Working result:
- The hold function itself works and in the end I can make the hold button widget destroy and call my character selection screen
Big Problem:
- The Bar is not updating. I am searching on tutorials, solutions..event dispatcher things and whatever for a week now and can't make it to work. I tried it inside the level blueprint, player controller, some blueprint actor. Whatever I do, the progress bar is not filling up. I added a lot of print strings to test and when holding a button, the "Max Time Held" fills up from 0 to 1 in a second (float) so at least its doing "something".
Do you have a clue why the UI does not update the progress bar or would you love to create some little tutorial on how to actually setup systems that don't need any in-level additions or actors but actually just work between the players input and the UI alone? All tutorials I found were either about stamina and health bars or pickup systems that need actors or in-game interactions but none of them tackled things like that.
Cheers and sorry for the long text.
Toby
Hi Toby mate, that sounds like a great idea. Yeah it sounds like everything works as it should, everything apart from visually seeing the bar fill up. So my first thought would be to make sure that you are setting the percentage filled in the bar in the widget correctly. I.e. you are doing it, it's in the correct widget, etc. If you want you can send me some screenshots via my email found on my channel's about page. And I can also add this onto my video list; Hold button to start game?
All the best!
Matt
I believe I probably messed up when it comes to casting or something else. Actually the widget is being called over an BP Interface, maybe thats a reason. One on Unreal Slackers told it could be that the Event Timer may hold it back from being updated on runtime on the widget. -- Actually the journey to a thing where I personally thought it would be an easy one took about a week to achieve. But from all tutorials.. your's really was the best to have for that. Big kudos to you!
Cheers!
@@sithmaster Ah right okay, well narrowing down to where the issue starts is always a great step forward in figuring out! Glad that I could help with my tutorials though mate, that's great to hear, glad I could do so. All the best mate, and let me know if there's anything you ever need again! :)
@@MattAspland Thank you so much! As a pure Senior Environment Artist with very little knowledge about coding, your knowledge and your videos are saving my day since I try to kick-off a vertical slice on my own - which hopefully becomes a bigger official project where real code-magicians will hopefully kill my current "Blueprints From Hell"..
@@sithmaster No problem at all mate, it's always a pleasure to help out. I know what it's like trying to make a vertical slice, and even a full game, on your own, so any time I can help out, just let me know! I wish you all the best man, good luck with this vertical slice, I'm sure it will be great and you'll get some programmers intrigued and joining!
Fantastic !
Thank you so much!
Hey Matt, this is amazing, exactly what I've been looking for fundamentally, I noticed @HoneyHive's comment and I can't say that I've played Day' Gone, so my request may be similar, but is there a way of making the progress bar a square shape or a circle, with the "E" key in the middle and having the progress bar gradually fill itself up clockwise around the key?
I have thought exactly the same, binding it to the animation. Have you done it?
Amazing
Thanks so much!
How would this work with replication? (as this setup won't work and will show the interact widget on both server and client)
Hi matt ive tried adding this to a character blueprint class as a pickpocket system on the back of an ai instead of an actor class and this doesnt seem to work, i was wondering if you have any idea why this is?
AWESOME : D
Thank you so much! :)
Thanks 😊
Happy to help :)
Welldone man, can this also be implemented as a "Press A Repeatedly" mechanic?
Thanks man, and absolutely! I may also do one for specifically that too
@@MattAspland nice can't wait man 🤘
Hey! Quick problem around 12:00, when I try to call TimeHeld from the WidgetRef, it doesn't show up in the search. Adding it without "Context Sensitive" selected make it say it's not compatible. Any ideas on how I could fix this?
Hey Matt this worked really well except that after I pick the item up the progress bar and the text doesn't disappear? Even after I have moved out of the box's region. Thoughts? On further examination, it has something to do with how close I am to the item. It works fine if I am farther away from it.
if you slap a do once before the widget creation on your bp and then have it reset after the widget is destroyed, it'll solve your problem
Hey! Good tutorial, but I was wondering how could You make progress bar fill smoothly, if You know what I mean. I'd love to see tutorial for that!
Hey, to increase it more smoothly you'd essentially want to increase the values by a smaller amount. I can maybe look into alternatives too :)
@@MattAspland Yup, that's one idea, but I think You have to do something else to make it really smooth.
@@mateuszsieczka7989 Yeah I think there is as well, I believe I've done it before so I'll keep looking into it more :)
nice
Thanks :)
Cool bro 😌👍
Thank you so much Sangeeth :)
Is it possible to not reset the timer and keep the last known time ?
great tut thank you so much but there's a bug when you are holding E and go away from the collision the event still going on
edit: for people having the same bug you have to set IsHeld? variable to false after removing the widget for parent
Thank you Thank you Thank you very much!!
Nice video
Thank you!!
hey i want it that when u let go of the button and start again it will start from where u left of i managed to make it destroy the object but the ui always restarts help will be much appreciated
Hey @Matt Aspland i have an issue 12:00 if i try to put widget ref to target self on set timeheld variable it says it is not compatible?
Edit:I Fixed it the issue was widget ref was on User widget blueprint and it needts to be on hold widget
Hey, glad to hear you fixed it, sorry for my delayed reply. Thanks for leaving your fix for others to see too :)
bro, could you show how to make a destination point appear on the screen at a specific location
(as in cyberpunk for example)
Hey man, I could definitely look into that one yeah!
@@MattAspland wohoo🤩👌
Do you mind if you can just do: On-screen text when near a character. So when I come up to a character it will say Press Enter To Switch. You click enter then you switch and it takes one second like you did for your first one in 14:45. Without the bar, just the text Can you pls do that?
Hey, you can do this exact same process I did with creating the widget on begin and end overlap. I responded to your comment before about this, maybe you didn't get notified. I have a video on a widget appearing and disappearing from your screen based on your proximity to something, and one on changing characters. Hope it helps :)
On Screen Prompt: ua-cam.com/video/Os7uf-wiU8o/v-deo.html
Changing Characters: ua-cam.com/video/GAlBfDtTcYE/v-deo.html
Is it possible to make it so it appears in the world and not sticks to the screen
this mf explains so well😭
How to make inventory system in unreal engine 4 Two objects Please
Hey like I've said, I've added it onto my list :)
Why MaxTimeHeld?
Isnt it JUST TimeHeld
Can we get a decent performance of unreal engine in 8gb ram in pc
Hey, you can definitely get decent performance. I started with 8gb and only found an issue with it when I started to build the games of larger maps. But yeah 8gb is definitely good enough.
I'm having an issue where the timer seemingly doesn't stop after I activate the hold mechanic (the action is a mesh that moves back and forth every time I hold E) ua-cam.com/video/PMaurpsYprU/v-deo.html
Help?
When I walk away the widget still stays on my screen
im getting this too
Remove from parent not working for me how fix?
Hey, make sure that it is connected properly I.e. the target is in our widget reference or the create widget. Also, make sure it is off of "End Overlap". Keep me updated :)
HA! Where was THIS a few months ago!? 😂😂😂
Haha, sometimes stuff it too late unfortunately lol