Best way to structure a project

Hi, I’m new with BPs and I’m struggling to implement what I want to achieve. Figured best to start again! I want to create a simple tool for viewing a masterplanning model of a university campus. It’ll basically be an interactive visual database - each of the simple building forms will have various ratings under categories like Age, Capacity, Fire Rating, etc. I want for the user to be able to press a key or click a UI icon and view the model in ‘Age’ mode, or ‘Capacity’ mode or whatever, with the app then colouring the model based on the current mode and the buildings’ various values. I’d also like to be able to click on individual blocks and bring up extra info.

How best to set this up with Blueprints? I’ve had some success turning individual building StaticMeshActors into Actor BPs and adding some functionality that way (with building ratings stored in both Actor and Component tags), and with the ‘OnKeyPress’ code sitting in the Level Blueprint. But I don’t want to remake the material change script in every single mesh, as that’ll be massively time consuming.

My thoughts were:

  • Set up two global variables (or equivalent): CurrentMode (string), and ModeChanged (boolean)
  • Set up all meshes to turn into individual Actor BP subclass which contains some sort of Function like ‘if mode changed, change mesh colour’
  • Set up code in the Level BP to record the current ‘mode’ on KeyPress / UI Click, and flag up that the mode has changed.
  • I guess the function within the individual building elements would then need to trigger every Tick to check if the mode has changed?

Is this the best way to do it? I’ll only have one ‘level’ so don’t object to heavy use of the Level BP. Another approach could be to pull all building meshes into one BP - would that be better, as there’d be less code passing between BPs? And where would I put the ‘OnClick’ function for the individual building data?

The aim is to structure this in a way that we could bring in different models of different universities yet keep the code pretty consistent, so separating the script and the meshes initially would be great.

Any advice appreciated! Thanks.

you’d make a generic building bp and then make children for the specific buildings.
maybe use a struct to contain some of the variables though that’s optional.

you probably wouldn’t use tick for anything.

basically you’d have a pawn. on event mouse click get hit results under mouse, send interface message.

then if what ever you clicked can receive the interface message, it sets a Boolean to true to represent that it’s selected, then the building sets an actor variable in the pawn to itself(that way the pawn knows whatever is currently selected).

if the pawn/ user clicks something that isn’t selectable then it deselects the building it has in reference after sending a deselect interface message to it…

this is all kindof assuming you want to allow only one building to be selected at a time. you could have little ui window open and close next to the selected buildings…
if you do that then you should have the buildings pop open a widget component and populate it with the data from whatever variables the building holds. then there’s a widget interaction component you could add to the pawn to further select things.

if you have a ui that is more locked to the users screen then you can have the pawn handle the creation of the widget.

technically you could use casting instead of interfaces(though interfaces are a technically method of casting), but if you end up adding selectable actors that aren’t buildings down the road interfaces will work better.

hopefully this is legible enough that you can kinda get the gist of what I’m saying. :slight_smile:

Thanks, that’s really helpful. I’ve managed to fudge something together that using the building child BP setup, and it seems to work okay so far. Time to read up on interfaces…