Note to others: If you forgot to uncheck the "Hide cursor during capture" on the "Set Input Mode Game and UI" node in your PlayerController, nothing will happen when you try to select. Excellent tutorial series so far!
If anyone is following this guide in 2023 and can't get the rectangle to display here's some advice: 1. Uncheck "Hide Cursors during capture" under your "Set Input Mode Game and UI" node in your PlayerController. 2. Double check under "Edit -> Project Settings -> HUD Class & Player Controller Class" if those are set to your new HUD and Controller 3. If you were silly like myself and you started with a C++ project or used a custom gamemode(Under Project Settings), go to your world (TopDownMap(Editor)), right click on it, select world settings, and change GameMode Override to the correct gamemode, then select the correct HUD and PlayerController.
For the people that can draw a rectangle but wont select anything, check the decal size, sometimes its a little to small it doesnt appear after setting the visibility.
Thank you for adding the arrows when you click things! It makes this so much easier to follow. I'm sure it takes a lot of time in post but it really is super helpful.
Only drawback is that it's done in the draw event handler on each tick so have to be careful not to call it every tick or have too many of the same actors or else there might be some performance hit. You see him put it behind a boolean flag here so it's not constantly called
This tutorial has the problem that all UE tutorials have: it doesn't explain the relationship between the files. We create a blueprint here, a HUD there, an interface here and so on, but how are they connected? What is the overall structure? I have not seen any tutorials that do this well. I know it is complicated and tedious to explain, maybe multiple graphs are necessary, but just because it is complicated, watchers will very likely have difficulties understanding it, so it really needs to be explained.
Probably because this isn't a beginner level tutorial. I would recommend looking at these 2 channels to learn the basics: @RyanLaley @MathewWadsteinTutorials Edit: But you are right. There's no standard with these tutorials since they're all done by individual creators, so there is no curriculum and the required amount of prior knowledge depends on the discretion of the tutorial creator.
That's a good question, it can certainly get confusing with things like GameState, GameMode, PlayerState, blueprint, HUD, interface, etc. However, the answer to that question is far to complicated to be within the scope of a gameplay tutorial. Moreover great observation that all tuts have this issue, it's very distracting to the target audience of a series like this. But like any good game programmer, we can break the problem down into more bite size chunks. It sounds like some of your question deals with general programming paradigms, architecture, and design patterns, and part of your question deals with UE specific things. I'll address some of these concerns and offer follow up info. The use of BP interfaces solves a problem with other forms of communication. The simplest way to have blueprint communication is through casting, however this increases the size of a BP and can lead to packaging errors, so interfaces are commonly used. Note casting to a native cpp class doesn't have this effect and Interfaces in BP don't behave the same as in other languages. The HUD is part of UE's framework classes. UE is not just a render engine, but a game engine so it comes with some architecture to speed up the development of games. I'll post a few links to help you get your bearings. I personally believe that much of the understanding will come with time. I certainly learn best by getting my hands dirty trying to figure something out and comparing that to how others did it when possible. I'll recommend a getting started with UE guide. Additionally, It's worth searching for what people think are the best beginner tutorials on UE's forums, Discord, etc. dev.epicgames.com/community/learning/courses/kna/hour-of-code-unreal-engine-build-your-first-3d-game/0b8a/hour-of-code-unreal-engine-create-your-first-3d-game // This has about 5 hours of guided tutorials(fun and designed to keep ppl engaged), provides example gameplay logic, tech art, and design out of the box, and encourages free form creativity in the end. I believe UnrealSensai(YT) has a tut where he explains things more in depth as well. czcams.com/video/EM_HYqQdToE/video.htmlsi=ddZsVzHDuqo8jTlW // great talk on BP communication. Offers more clarification on interfaces dev.epicgames.com/community/unreal-engine/getting-started/games // Series on getting started, very general. // Framework guides: Shows the overall structure with graphs and such as you requested dev.epicgames.com/documentation/en-us/unreal-engine/gameplay-framework-in-unreal-engine www.tomlooman.com/unreal-engine-gameplay-framework/ cedric-neukirchen.net/docs/multiplayer-compendium/common-classes/ Mat Wadstien's YT channel or Ari's Notes, etc. for quick and specific questions. Once you're curious about a specific thing, additional In depth tutorials and talks can be found on UE's learning portal, Such as "Introduction to AI with Blueprints", "Materials Master Learning", "Animation Ecosystem for Game Dev", "Your First Hour in UMG", "Blueprint Essential Concepts". dev.epicgames.com/community/unreal-engine/learning?source=epic_games&sort_by=views_count&types=tutorial,course,talks_and_demos,livestream,learning_path,knowledge_base,knowledge_base&industries=games Some Samples games can be found here, as it's a good idea to see how someone else did something: dev.epicgames.com/documentation/en-us/unreal-engine/samples-and-tutorials-for-unreal-engine Note: there are additional legacy samples not shown. I believe you'll find some answers and have many more questions from those links!
For anyone having a bug where certain units don't get deselected (e.g., if I just click in a far away spot, all of them should get deselected), it's because he's deleting elements in an array, while iterating through that array. To fix it, create a new variable vector of actors you'd like to remove, and then after you found all the actors you want to remove, you can iterate through that new variable and remove them from Selected Units. Make sure to also clear this new variable vector after you remove stuff! :)
Those of you that wants to replicate this in C++. Create a new class overriding the "AHUD" class. Implement this function: virtual void DrawHUD() override; It is basically the "Event Receive Draw Hud" equivalent. Then set the default AHUD to your custom created AHUD override class. Just be cautious this is called on tick (same as BP version)
Thanks a lot you saved me a lot of time. I was triying do the resolving logic if actor is within rectangle or not in my project complicated by math, went on youtube for some hints, and you just pulled out the "Get Actors in Selection Rectangle" node which I had no idea it existed (But I tried searching for some similiar helper util function but found nothing)
Running in a bit of an issue with drawing the rectangle. For some reason when i click and hold the mouse button it does not draw the rectangle. Any suggestions as far as troubleshooting? I went over the video quite a few times and i cant figure out why its not working for me.
16:00 For anyone wondering, there is also a "contains" node to replace "Find & ==-1". However you need to use the False branch then. Great videos by the way
I ran into an issue that I figured out. If you are adding "Marquee Held", "Marquee Pressed" or "Marquee Released" to the PlayerController and it has a yellow target then you can't connect the "Get Hud" function to it. In order for it to be a blue target you have to drag a line out from "Get Hud" and place it in an empty spot. Then it reveals the correct option to connect it to.
I'm using Unreal Engine 5 and repeating all the steps, checking twice, but deleting units from the selected array is very slow. May be any one know reason?
OMG, I was troubleshooting why the box wouldn't show up, it turned out that the RTS_PLAYER_CONTROLER blueprint for "Set Input Mode Game And Ui" setting box for "Hide Cursor During Capture" was ticked ON instead of off. Once i changed it, it worked like a charm. took me a solid 30 minutes to figure out, watching the video over and over.
I followed each step of the Interface PlayerController and HUD but when I hold down the mouse button it disappears and the rectangle just doesn't appear, anyone knows why?
If some one would be so kind as to suggest some possible solutions, i would greatly appreciate it. When i click and drag it dose indeed draw a box. So all of that is working. The up and down axix for the drawn box is perfect, and follows my cursor. But the left and right axis of drwan box is inverted. Iv tryed many many things, no dice. Please assist if possable.
can anyone give me the solution on how to modify the code so there will be sticky selection, it doesn't deselect units until new units are selected, or a key like esc is pressed?
Hey ho :) still cant find solution for one issue. (Sorry for my english, its not perfect) Ive got a problem that when i try to mark units its looks like they have alot bigger mark field... so if i wanna try to mark one it automaticly mark 2-3 units. And even small marquee box can mark almost everyone. Someone have solution for that? And it depends on the cammera position
@@middleagedshred My problem is that my Event Marquis are not coming from the RTS_Interface in RTS_Marquis_HUD. Make sure that the Event Marques Released, Held, Pressed are the ones on the Interface
Dude thank you. I am doing another tutorial and got stuck for god knows how long and the first 1:20 seconds I find out that I need to select that HUD in the project settings. Can you point me in the direction of having a different HUD depending on the character you're possessing?
Do I need the RTS player input for the Marque section? Can this Marque select inside a selection instead of UE5 select everything it touches? I had not watched the entire video yet.
So if u put your unit and camera in way where 1 click will select both of them, have can I disable such effect. Still wanna select both if I held and draw a little rect, but I don't want to select both, especially the unit that is behind the other one that I wanted to select with 1 single click
Adding the interface to the PlayerController (4:12) isn't necessary as you can still call interface events from non-inherited blueprints. Only need to add the interface to the HUD blueprint we create.
This is a great way to do it! But, I'm having an issue because I put a sphere collision on my units to give them a sight radius and they get selected if that radius is within the rectangle. How could I get the rectangle to ignore that component? I've tried changing the collision settings on the sphere collison, but no luck so far
İ made everything according to Jon and they re working but now i need to add some input action or keyboard events but they dont fire, even a print string is impossible for them. İ change auto receive input value to 0 and un check the block input box in the class defaults but nothing seems to change. What can be the problem ? All the help that i can get is much apperaciated.
Heya Jon, very awesome infos ! I would like to ask if in the event of a multiplayer versus/coop, getting the player controller at index 0 to draw the rectanble sampling actors would cover the replication (as in players would see their own drawing only and gather their own data only unless we want to replicate a specific side of that) ? I hope the question is clear enough and cheers !
I can't seem to find the third person animation for unit 1. I used the Quinn animation for unit 2 and it worked fine. Unit 1 won't work for any animation, it just stays in the same pose no matter what animation I select please help 🙏
There is. It's annoying math, but it's still just multiplication subtraction and addition to make it work. I would show pics of the setup but I don't think I can post pics on CZcams.
Just ran into this and for me it was the chain "Event: Event Marque Released -> Set: Is Drawing Bool" The bool should be set to False, or unchecked. I had it checked so it was constantly drawing after releasing the L mouse button.
I find that the marquee moves with my camera when I get close to the edge. I'd like the marquee's start corner to lock relative to the world, not the HUD, so that I can select multiple units spread around the map, outside the bounds of my camera when I scroll around while still drawing the rectangle. Is this achieved by affecting the mouse start position variable?
This is six months too late, but I just recently decided to look into this and I found the solution. Firstly, you are right. It's done by affecting the mouse start variable. I made a second mouse start variable called Mouse Start Pos Adj, or Adjusted Mouse Start Pos and hooked that up to the held event. I used the camera's world position, except for Z because I don't need it, and basically added that onto the solution in the video. I'd like to post screenshots to help people more but I don't think CZcams would take kindly to it. Just keep in mind it's doable, and it's pretty simple, but the math is wonky and axes have to be inverted for no discernible reason sometimes. It's nothing more than multiplication, subtraction and addition though.
@@middleagedshred i actually came up with a much better version than what I mentioned before. Maybe I could try to make a video on it at some point, but I'm not a good tutorial creator or educator.
@@middleagedshred It may be simple enough for me to tell you how it works without any visuals, but it has been quite a long time since I've played around with Unreal Engine, so I apologize if I do a bad job explaining it or am wrong about something. I also can't find the project I did this in for some reason, but I'll continue looking for it and give more details if I can find it. In essence, my solution was to set the marquee selection's start pos variable to correspond with the world coordinate of wherever you started the selection. This way, you don't need to worry about things inverting or having to do math when the camera rotates. It's also generally much simpler and more flexible. To be more specific, I did a line cast from the camera to the world based on the cursor's position by using the Convert Mouse Location to World Space node. The logic is practically the same as if you were trying to program a way to select a unit under your cursor, but we don't need any of that additional logic. We just want the world coordinates. The world coordinates were then used as the starting point for the selection box. This bypasses most of the manual math of my first method, but has the flaw that it requires the line cast to hit a valid surface. This, of course, is quite easy to remedy (assuming it becomes a problem at all), since you can just place a plane or something to cover the entire playable area and then use a custom collision channel for the line trace and plane. Aside from the starting point being based on world coordinates, the method is effectively the same as the video.
I found the solution; I put the decal size bigger and it appear. But now, if I put it less then 33 X, it disappears. The smaller I adjust it, the clearer it becomes and becomes invisible. If there's a way to make decal less opacity, please tell me. I tried on the material changing the opacity value to negative, but, it didn't work.
Hello, very nice tutorial ! I was wondering what happens if you're dragging a rectangle to make a selection and your mouse touch the edge of the screen ?I guess the first corner of the rectangle will move with the camera, am I right ? How would you resolve that ?
Great tutorial, thanks much! I have followed this, and one of my Unit classes working perfectly fine, while the other is not being returned by "Get Actors In Rectangle". They both extend the ParentUnit. Also if I instantiate the parent unit directly to test it also has the issue. I have used print statement that show it really is the return value of the "Get Actors In Rectangle" that does not have these units. Is there some sort of setting that I am missing on some of these classes that would cause them to be ignored by the selection rectangle? I asked chatgpt and it recommended checking the collision setting, but the collision settings are the same on the working unit and the broken unit
I'm currently trying to figure this out too. I got my curser to start showing up but I've gone over everything in the first two videos multiple times, and I have a carbon copy of everything (except the hide curser checkbox) shown in the videos in my project. I think there may be a settings or set up option somewhere in the engine that I don't know enough about it all to click. I'm also operating on Unreal 5.1, but I doubt that has anything to do with it
Nvm, if you reload UE 5, for some reasons somes parameters changed. So I checked again that 1:15 and my settings was the old one (default one) so I just rechanged that, and now it's working.
@@Seaulo Same here, but what was incorrect there? Still can't get "add" button at "implemented interfaces". Only "Inherited Interfaces" are available, what is difference by the way?
In case you haven't found a solution: You can use 4x "Draw Line". One line would be your StartingMousePositionX for "Start Screen X" and "EndScreenX". Then StartingMousePositionY would go into "Start screen Y" and CurrentMousePositionY would go into "End Screen Y". Sorry it's hard to explain in text :D
@@Gloromo Yea man I managed to do it using the Draw line to draw an outline around the opaque rectangle to get an exact replica of the windows drag select box and also fully customiseable.. the script is spaghetti city but I just added it to the end of this marquee select tutorial code and I amazed myself at it working..)
I don't know why i did but i used the Event ActorOnReleased instead of Event Marquee Released and it took me awhile to found it out why my drawing was not removed after i released the mouse button when drawing the rectangle :S
what would you do in the scenario where you have a HUD class that consumes Input away from the player controller, when playing with this locally I found that it requires you to double click in order to switch the mouse focus to the HUD before you can drag
Note to others: If you forgot to uncheck the "Hide cursor during capture" on the "Set Input Mode Game and UI" node in your PlayerController, nothing will happen when you try to select.
Excellent tutorial series so far!
life saver!
Thank you. You are a life saver. : )
Bloody hell! That's 30 mins of my life! thank you so much!!
spent more time debugging that than id like to admit, thank you
OMG Thanks You So Much :)
If anyone is following this guide in 2023 and can't get the rectangle to display here's some advice:
1. Uncheck "Hide Cursors during capture" under your "Set Input Mode Game and UI" node in your PlayerController.
2. Double check under "Edit -> Project Settings -> HUD Class & Player Controller Class" if those are set to your new HUD and Controller
3. If you were silly like myself and you started with a C++ project or used a custom gamemode(Under Project Settings), go to your world (TopDownMap(Editor)), right click on it, select world settings, and change GameMode Override to the correct gamemode, then select the correct HUD and PlayerController.
God like comment
I don't know you but I do know I love you
not all heros wear capes.
For the people that can draw a rectangle but wont select anything, check the decal size, sometimes its a little to small it doesnt appear after setting the visibility.
THANK YOU I THOUGHT I DID SOMETHING WRONG XD
Thank you for adding the arrows when you click things! It makes this so much easier to follow. I'm sure it takes a lot of time in post but it really is super helpful.
that GetActorsInSelectionRect is amazing
Only drawback is that it's done in the draw event handler on each tick so have to be careful not to call it every tick or have too many of the same actors or else there might be some performance hit. You see him put it behind a boolean flag here so it's not constantly called
This tutorial has the problem that all UE tutorials have: it doesn't explain the relationship between the files. We create a blueprint here, a HUD there, an interface here and so on, but how are they connected? What is the overall structure? I have not seen any tutorials that do this well. I know it is complicated and tedious to explain, maybe multiple graphs are necessary, but just because it is complicated, watchers will very likely have difficulties understanding it, so it really needs to be explained.
@@joeydg1431 That's not computer science bro, it's something you need to understand to get a job as a games programmer.
Probably because this isn't a beginner level tutorial. I would recommend looking at these 2 channels to learn the basics:
@RyanLaley
@MathewWadsteinTutorials
Edit: But you are right. There's no standard with these tutorials since they're all done by individual creators, so there is no curriculum and the required amount of prior knowledge depends on the discretion of the tutorial creator.
That's a good question, it can certainly get confusing with things like GameState, GameMode, PlayerState, blueprint, HUD, interface, etc. However, the answer to that question is far to complicated to be within the scope of a gameplay tutorial. Moreover great observation that all tuts have this issue, it's very distracting to the target audience of a series like this. But like any good game programmer, we can break the problem down into more bite size chunks. It sounds like some of your question deals with general programming paradigms, architecture, and design patterns, and part of your question deals with UE specific things. I'll address some of these concerns and offer follow up info.
The use of BP interfaces solves a problem with other forms of communication. The simplest way to have blueprint communication is through casting, however this increases the size of a BP and can lead to packaging errors, so interfaces are commonly used. Note casting to a native cpp class doesn't have this effect and Interfaces in BP don't behave the same as in other languages. The HUD is part of UE's framework classes. UE is not just a render engine, but a game engine so it comes with some architecture to speed up the development of games. I'll post a few links to help you get your bearings.
I personally believe that much of the understanding will come with time. I certainly learn best by getting my hands dirty trying to figure something out and comparing that to how others did it when possible. I'll recommend a getting started with UE guide. Additionally, It's worth searching for what people think are the best beginner tutorials on UE's forums, Discord, etc.
dev.epicgames.com/community/learning/courses/kna/hour-of-code-unreal-engine-build-your-first-3d-game/0b8a/hour-of-code-unreal-engine-create-your-first-3d-game
// This has about 5 hours of guided tutorials(fun and designed to keep ppl engaged), provides example gameplay logic, tech art, and design out of the box, and encourages free form creativity in the end. I believe UnrealSensai(YT) has a tut where he explains things more in depth as well.
czcams.com/video/EM_HYqQdToE/video.htmlsi=ddZsVzHDuqo8jTlW // great talk on BP communication. Offers more clarification on interfaces
dev.epicgames.com/community/unreal-engine/getting-started/games // Series on getting started, very general.
// Framework guides: Shows the overall structure with graphs and such as you requested
dev.epicgames.com/documentation/en-us/unreal-engine/gameplay-framework-in-unreal-engine
www.tomlooman.com/unreal-engine-gameplay-framework/
cedric-neukirchen.net/docs/multiplayer-compendium/common-classes/
Mat Wadstien's YT channel or Ari's Notes, etc. for quick and specific questions. Once you're curious about a specific thing, additional In depth tutorials and talks can be found on UE's learning portal, Such as "Introduction to AI with Blueprints", "Materials Master Learning", "Animation Ecosystem for Game Dev", "Your First Hour in UMG", "Blueprint Essential Concepts".
dev.epicgames.com/community/unreal-engine/learning?source=epic_games&sort_by=views_count&types=tutorial,course,talks_and_demos,livestream,learning_path,knowledge_base,knowledge_base&industries=games
Some Samples games can be found here, as it's a good idea to see how someone else did something:
dev.epicgames.com/documentation/en-us/unreal-engine/samples-and-tutorials-for-unreal-engine
Note: there are additional legacy samples not shown.
I believe you'll find some answers and have many more questions from those links!
For anyone having a bug where certain units don't get deselected (e.g., if I just click in a far away spot, all of them should get deselected), it's because he's deleting elements in an array, while iterating through that array. To fix it, create a new variable vector of actors you'd like to remove, and then after you found all the actors you want to remove, you can iterate through that new variable and remove them from Selected Units. Make sure to also clear this new variable vector after you remove stuff! :)
or replace "for each loop" to "reverse for each loop"
@@darexsu9487 I had that bug when trying to control the higher numbers of units like 50 of them and your solution seems to work 👍
Those of you that wants to replicate this in C++. Create a new class overriding the "AHUD" class. Implement this function:
virtual void DrawHUD() override;
It is basically the "Event Receive Draw Hud" equivalent. Then set the default AHUD to your custom created AHUD override class. Just be cautious this is called on tick (same as BP version)
Thanks a lot you saved me a lot of time. I was triying do the resolving logic if actor is within rectangle or not in my project complicated by math, went on youtube for some hints, and you just pulled out the "Get Actors in Selection Rectangle" node which I had no idea it existed (But I tried searching for some similiar helper util function but found nothing)
Running in a bit of an issue with drawing the rectangle. For some reason when i click and hold the mouse button it does not draw the rectangle. Any suggestions as far as troubleshooting? I went over the video quite a few times and i cant figure out why its not working for me.
Try unchecking "Hide Cursor During Capture" on the Set Input Mode Game And UI node in the RTSplayercontroller. that worked for me.
@@skaughtii Thanks
@@skaughtii you are superhero.
Thank you so much!! @@skaughtii
16:00 For anyone wondering, there is also a "contains" node to replace "Find & ==-1". However you need to use the False branch then.
Great videos by the way
Thanks, that makes more sense. I used the suggestion and make the adjustment in the next video!
I ran into an issue that I figured out. If you are adding "Marquee Held", "Marquee Pressed" or "Marquee Released" to the PlayerController and it has a yellow target then you can't connect the "Get Hud" function to it. In order for it to be a blue target you have to drag a line out from "Get Hud" and place it in an empty spot. Then it reveals the correct option to connect it to.
I'm using Unreal Engine 5 and repeating all the steps, checking twice, but deleting units from the selected array is very slow.
May be any one know reason?
danke für dein Video, richtig gut erklärt!
Event tick??
Wouldn't it be easier to make a timer?
When pressed to start the timer
When depressed, clear the timer
OMG, I was troubleshooting why the box wouldn't show up, it turned out that the RTS_PLAYER_CONTROLER blueprint for "Set Input Mode Game And Ui" setting box for "Hide Cursor During Capture" was ticked ON instead of off. Once i changed it, it worked like a charm. took me a solid 30 minutes to figure out, watching the video over and over.
I followed each step of the Interface PlayerController and HUD but when I hold down the mouse button it disappears and the rectangle just doesn't appear, anyone knows why?
You need to go to RTS_PlayerController and unclick Hide cursor during capture from set input mode game and ui.
In project Settings and you type Def, HUD Class wont let me change it to RTS_MarueeHUD.
If some one would be so kind as to suggest some possible solutions, i would greatly appreciate it. When i click and drag it dose indeed draw a box. So all of that is working. The up and down axix for the drawn box is perfect, and follows my cursor. But the left and right axis of drwan box is inverted. Iv tryed many many things, no dice. Please assist if possable.
Why was PlayerController implementing the interface? It appears the events are implemented in the HUD object, not the Player Controller.
can anyone give me the solution on how to modify the code so there will be sticky selection, it doesn't deselect units until new units are selected, or a key like esc is pressed?
id love to add a hotkey to follow selected units. I'll try figure it out. but great video
Hey ho :) still cant find solution for one issue. (Sorry for my english, its not perfect) Ive got a problem that when i try to mark units its looks like they have alot bigger mark field... so if i wanna try to mark one it automaticly mark 2-3 units. And even small marquee box can mark almost everyone. Someone have solution for that? And it depends on the cammera position
Im Sure I Missed Something but i cant tell what. When i try to draw the RECT my Mouse Disapears but no Rectangle is drawn?
Fixed that, Now it starts at the top left of the screen. and im stuck again lmao
Uncheck Cursor on the "Set Input Mode Game and UI"...thx to SrJones240
i have the same issue, does anyone have any idea to fix it?
any way to make the rectangle empty when we draw? been trying to figure it out but I can't :/
here is the solution czcams.com/video/U6BOslpoglE/video.html
Did you work it out?
@@middleagedshred My problem is that my Event Marquis are not coming from the RTS_Interface in RTS_Marquis_HUD. Make sure that the Event Marques Released, Held, Pressed are the ones on the Interface
Dude thank you. I am doing another tutorial and got stuck for god knows how long and the first 1:20 seconds I find out that I need to select that HUD in the project settings. Can you point me in the direction of having a different HUD depending on the character you're possessing?
Amazing tutorial
Do I need the RTS player input for the Marque section?
Can this Marque select inside a selection instead of UE5 select everything it touches?
I had not watched the entire video yet.
So if u put your unit and camera in way where 1 click will select both of them, have can I disable such effect. Still wanna select both if I held and draw a little rect, but I don't want to select both, especially the unit that is behind the other one that I wanted to select with 1 single click
Adding the interface to the PlayerController (4:12) isn't necessary as you can still call interface events from non-inherited blueprints. Only need to add the interface to the HUD blueprint we create.
This is a great way to do it! But, I'm having an issue because I put a sphere collision on my units to give them a sight radius and they get selected if that radius is within the rectangle. How could I get the rectangle to ignore that component? I've tried changing the collision settings on the sphere collison, but no luck so far
Did you figure it out? I am trying to implement something similar
I followed all these steps but it wont draw a rectangle and wont select anaything. COuld somebody Help me ?
İ made everything according to Jon and they re working but now i need to add some input action or keyboard events but they dont fire, even a print string is impossible for them. İ change auto receive input value to 0 and un check the block input box in the class defaults but nothing seems to change.
What can be the problem ?
All the help that i can get is much apperaciated.
Heya Jon, very awesome infos ! I would like to ask if in the event of a multiplayer versus/coop, getting the player controller at index 0 to draw the rectanble sampling actors would cover the replication (as in players would see their own drawing only and gather their own data only unless we want to replicate a specific side of that) ?
I hope the question is clear enough and cheers !
TY
Feels like the selection triggers a lot further to the units that i thought. is it because maybe my unit collision is too big?
I can't seem to find the third person animation for unit 1. I used the Quinn animation for unit 2 and it worked fine. Unit 1 won't work for any animation, it just stays in the same pose no matter what animation I select please help 🙏
Change the skeletal mesh to SKM_Manny and the ABP_Manny Anim Class should work.
i import manequin with ue4, also dont know how to make these new ones run
Is there a way to do draw rect in world instead on hud?? If you draw a rect and move the camera the selection box move with the camera.
I have the same issue. When I select rect stays and doesn't going away and moves with camera
There is. It's annoying math, but it's still just multiplication subtraction and addition to make it work. I would show pics of the setup but I don't think I can post pics on CZcams.
Loving the tutorials so far! Somehow my marquee windows doesn't close after I release left mouse button, any clue what could be the problem?
Just ran into this and for me it was the chain "Event: Event Marque Released -> Set: Is Drawing Bool" The bool should be set to False, or unchecked. I had it checked so it was constantly drawing after releasing the L mouse button.
merci mec
Big THANK YOU :)
I find that the marquee moves with my camera when I get close to the edge. I'd like the marquee's start corner to lock relative to the world, not the HUD, so that I can select multiple units spread around the map, outside the bounds of my camera when I scroll around while still drawing the rectangle. Is this achieved by affecting the mouse start position variable?
This is six months too late, but I just recently decided to look into this and I found the solution. Firstly, you are right. It's done by affecting the mouse start variable. I made a second mouse start variable called Mouse Start Pos Adj, or Adjusted Mouse Start Pos and hooked that up to the held event. I used the camera's world position, except for Z because I don't need it, and basically added that onto the solution in the video. I'd like to post screenshots to help people more but I don't think CZcams would take kindly to it.
Just keep in mind it's doable, and it's pretty simple, but the math is wonky and axes have to be inverted for no discernible reason sometimes. It's nothing more than multiplication, subtraction and addition though.
@@TheFishCostume Any chance you could do a vid tutorial for this?
@@middleagedshred i actually came up with a much better version than what I mentioned before. Maybe I could try to make a video on it at some point, but I'm not a good tutorial creator or educator.
@@TheFishCostume just a screen recording of you building it from scratch would be amazing
@@middleagedshred It may be simple enough for me to tell you how it works without any visuals, but it has been quite a long time since I've played around with Unreal Engine, so I apologize if I do a bad job explaining it or am wrong about something. I also can't find the project I did this in for some reason, but I'll continue looking for it and give more details if I can find it.
In essence, my solution was to set the marquee selection's start pos variable to correspond with the world coordinate of wherever you started the selection. This way, you don't need to worry about things inverting or having to do math when the camera rotates. It's also generally much simpler and more flexible.
To be more specific, I did a line cast from the camera to the world based on the cursor's position by using the Convert Mouse Location to World Space node. The logic is practically the same as if you were trying to program a way to select a unit under your cursor, but we don't need any of that additional logic. We just want the world coordinates. The world coordinates were then used as the starting point for the selection box. This bypasses most of the manual math of my first method, but has the flaw that it requires the line cast to hit a valid surface. This, of course, is quite easy to remedy (assuming it becomes a problem at all), since you can just place a plane or something to cover the entire playable area and then use a custom collision channel for the line trace and plane. Aside from the starting point being based on world coordinates, the method is effectively the same as the video.
Hey Jon, can you help me? I can do the "drawing rectangle", but It isn't showing the green "selected decal". Please help.
I found the solution; I put the decal size bigger and it appear. But now, if I put it less then 33 X, it disappears. The smaller I adjust it, the clearer it becomes and becomes invisible. If there's a way to make decal less opacity, please tell me. I tried on the material changing the opacity value to negative, but, it didn't work.
Hello, very nice tutorial !
I was wondering what happens if you're dragging a rectangle to make a selection and your mouse touch the edge of the screen ?I guess the first corner of the rectangle will move with the camera, am I right ?
How would you resolve that ?
that is because its selecting from the HUD not the world u feel? im new so i wouldnt know how to fix that but im fairly sure its that
Great tutorial, thanks much! I have followed this, and one of my Unit classes working perfectly fine, while the other is not being returned by "Get Actors In Rectangle". They both extend the ParentUnit. Also if I instantiate the parent unit directly to test it also has the issue. I have used print statement that show it really is the return value of the "Get Actors In Rectangle" that does not have these units. Is there some sort of setting that I am missing on some of these classes that would cause them to be ignored by the selection rectangle? I asked chatgpt and it recommended checking the collision setting, but the collision settings are the same on the working unit and the broken unit
Woops never mind. It was because I had the "class selection" parameter set in the get actors in rectangle mode.
I love U brother. U R awesome😄😘
i cant implement interface plase what the issue??
...can´t believe that be so complicated .. to make a simple thing.. in others programs it´s comes in defaults functions...
Not getting a rectangle. I’ve unchecked the box everyone is talking about and still no dice.
I'm currently trying to figure this out too. I got my curser to start showing up but I've gone over everything in the first two videos multiple times, and I have a carbon copy of everything (except the hide curser checkbox) shown in the videos in my project. I think there may be a settings or set up option somewhere in the engine that I don't know enough about it all to click. I'm also operating on Unreal 5.1, but I doubt that has anything to do with it
@@DanielEleveld Any news about that ? Same problem there
Nvm, if you reload UE 5, for some reasons somes parameters changed. So I checked again that 1:15 and my settings was the old one (default one) so I just rechanged that, and now it's working.
@@TheWolfPiano I’ll try that! Up till now no solution for me
For whatever reason I cant change Implemented Interfaces, but I can change inherited Interfaces. Is there a difference?
Found my issue, in the RTS_MarqueeHUD I didn't use the correct (Marquee Pressed/Held/Released) Actions. Once I realized this it worked after that!
@@Seaulo Same here, but what was incorrect there? Still can't get "add" button at "implemented interfaces". Only "Inherited Interfaces" are available, what is difference by the way?
@@Mr_Fa1L Same problem, any solutions ? I don't really understand the "didn't use the correct actions".
TheBest
is it possible to make the rectangle just an outline like in most other RTS?
In case you haven't found a solution: You can use 4x "Draw Line". One line would be your StartingMousePositionX for "Start Screen X" and "EndScreenX". Then StartingMousePositionY would go into "Start screen Y" and CurrentMousePositionY would go into "End Screen Y".
Sorry it's hard to explain in text :D
@@Gloromo Yea man I managed to do it using the Draw line to draw an outline around the opaque rectangle to get an exact replica of the windows drag select box and also fully customiseable.. the script is spaghetti city but I just added it to the end of this marquee select tutorial code and I amazed myself at it working..)
parent unit class nasıl oluşturuyoruz
I don't know why i did but i used the Event ActorOnReleased instead of Event Marquee Released and it took me awhile to found it out why my drawing was not removed after i released the mouse button when drawing the rectangle :S
How did you fixed it? I used Event Marquee Released and yet when I select that rectangle stays and not going away
Всё в порядке
Thanks bro!
what would you do in the scenario where you have a HUD class that consumes Input away from the player controller, when playing with this locally I found that it requires you to double click in order to switch the mouse focus to the HUD before you can drag
I had the same issue. In the RTS_PlayerController blueprint, uncheck "Hide Cursor During Capture" within the "Set Input Mode Game And UI" node.