Add a BP actor, called Parent Building Class
Add building mesh (untick receive decals),
Selected Decal (change decal mat, size 100, rotate -90m location -10, and untick visible in rendering)
R click the parent building class to create child BP class, name as First Building
Change the mesh in First building, drag it in scene
Go to RTS Interface,
Rename Select unit and de select unit as select this and de select this
Back to Parent building class, class setting, add RTS interface
In event graph:
Go to Parent Unit Class graph, update and replace the event (de)select this nodes:
Double check RTS Marquee HUD too, see if anything not complied, after rename RTS interface from “unit” to “this”
Open Player Controller:
Left mouse button event node, modify between Marquee Pressed message node
(add actor variable selectedbuilding)
Collapse a marcos for selected nodes, name as HandeBuildingClick
Final looks as:
Now the building can be selected. To de-select it:
Go to RTS interface, add new function for clearing:
Go to Player Controller, create events for the clearing:
Go into Handle Building Click Marco just created, add the follow (to clear anything before selected input):
Marquee selection created in previous lesson has to be activated by connect false branch to output:
Optional:
For RTS game normally don’t want be able to select both characters and the buildings, now it is possible to do so coz after select the building, rectangle selection function can still be used to select character:
To solve this:
Go to Marquee HUD graph, Get Actors in Selection Rectangle node (in Check for Actors under the Rectangle Command)
Change class filter from actor to parent unit class
Then in Select units under rectangle command, add clear selected unit
Now if select the building, then use rectangle to select unit character, the building will be automatically deselected