Unreal Engine - Don't Use Print String!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right everyone a quick video for you today uh this one is to quickly cover how you might be using Unreal wrong and importantly uh using the ever uh huge utility of print string I wanted to show real fast on uh the setup of you're probably setting this up wrong especially when you're actually doing some more uh than just some basic debug so the very basic example of this let's do like a left Mouse button input uh put that in here let's change this and be like uh left Mouse button pressed hey that's awesome all right compile save and then jump into game uh left Mouse button pressed you can see there up at the top left hey that's awesome so anytime that you know you're you're doing a sort of debug input that's great but uh things get pretty complicated pretty fast and you might be noticing this when uh you want to do a little bit more uh complex debugging right so let's say I want to know you know the specific name of the the pawn or the actor or whatever that actually done this right so I can I can do like get display name right of the the person so let's just point to reference self uh all right well I need to plug this in well all right you might have figured out hey you know I could just do like an aend string and that's what I've used you know for so many years that's actually pretty awesome so like I don't know a pen string space colon uh press left Mouse button yay well okay that cool that works you know let's uh clean this up for those that like nice and neat all right good enough uh and then jump in game and you can see hey you know player third person character c0 which is just you know your basic character press left B button all right that's awesome uh well let's further complicate this right well let's uh get o uh get actor location uh oh okay all right let's add that in well now we're going to have to kind of append this um we could do something kind of ugly and then do like a shift enter to make a new line and say like location colon and then now we have to add something else on top of that and also we have to include like a space and then add a pin and then insert that into the pin and now this is starting to get kind of silly but this will work right so here let's jump back in the game then now hey that totally works I mean that's fine for now you can see my location you can see I press the left Mouse button now it's the you know this particular character uh let's further complicate this right so let's say instead of the left Mouse button uh we do right Mouse button right oh boy um how are we going to add this into here well we can uh it's just going to be kind of annoying all right well that's fine all right let's do this so let's do uh how do we do this again we get uh uh utilities I think it's the uh which one was it again sorry I haven't done this in a little bit all right key get display there it is all right get the display name and this isn't the enhanced input this is the old input system but that's okay we're not too worried about it this is just more so for demonstration all right so in order to make this happen that's right we have to set this as a variable so I might speed this along I'll speed this up in the video so you won't miss anything while I'm doing this all right sorry about that I had that in the old video uh okay so now that we have uh key name displayed uh we will now want to actually display that key name that is actually displayed oh okay well we can add that in here if we wanted to and then go like key name and then whatever and then we have to add another one oh no so now the key name all right fine whatever uh compile save and then go here and then you know left Mouse button right Mouse button hey that's great well now let's uh let's say that your boss or customer or whoever says well I want these rearranged I don't want the key name to be below the location I want to switch these well that's just a pain you see you see see how like how frustrating a lot of this stuff can become right so like it's just like well now I need to move this stuff around so I'll put that here instead and then this here instead and then this here instead and then this is the key okay so like you can see how like this is this is now kind of unwieldy and you have to remember you know shift enter for which one goes where right so like stop doing this stop stop making your life more complicated than it has to be especially when you're appending strings together to make you know an output of this like this is this is silly stop doing this um the reason why you're running into this is because there's no like format of of a of a string instead so instead of doing all this right you don't need to do all this you can actually use print text hey well what does that do versus print string the thing that it does is allows you to do format text and what's super cool about this is you can actually um with with the uh different brackets you can actually open up um different variables on the format text so in here like let's say uh we do player name O player name close that uh and then shift enter uh let's actually let's just see what that does so player name that actually opens up a wild card for you to actually uh plug whatever you want in so here let's let copy that in player name is that uh so let's say and then on top of that player name uh space press um colon or let's let's do it the same way that we set it up before shift enter pressed and then here we can say uh Open Bracket key close that and I can see that key just opened up hey that's awesome so now I can take the same thing and since this is also a text actually I created it as a text didn't create it as a string directly in as a string oh since it is a wild card this will format down whatever input you're actually getting it so the same thing with uh get actor location too like let's take it directly we don't even have to do like a string conversion right uh so in include in there uh pressed key whatever uh just clean that up and then location uh colon or whatever uh and then do the same thing uh location there you go so now I just created the location wild card and I can input into that oh look at that so it says uh format argument may only include or may only be bite integer int float double blah blah blah blah blah you can read the rest of that so yes okay VC three I was incorrect my bad sorry so you can just do two string and then you could do two string vector and there you go that will work or you could do like two uh this should work uh two text I think yes all right cool and then that works too but apparently now it's a string input so let's fix that so yeah to text if you wanted to keep everything as text it doesn't really matter it will it will respond now let's say let's change this to print text instead compile save and voila look at that isn't that so much easier than doing these crazy append uh over and over again don't don't don't do this do this all right good luck developers we'll see you in the next one cheers
Info
Channel: Kaze of Kami
Views: 229
Rating: undefined out of 5
Keywords:
Id: dO70f5SiEVA
Channel Id: undefined
Length: 8min 57sec (537 seconds)
Published: Tue Mar 19 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.