Hello! Been trying to get the basic mechanics of a project down for the past couple of days. Most of it works as I hoped, but I am receiving an error from the method I’ve done. Essentially I simply want a linetrace to outline meshes within different pawns.
In the image above each of the TVs is a different pawn. They’re suppose to be different meshes, but for troubleshooting purposes i just duplicated the blueprint. All the blueprint work is actually in the FirstPersonCharacterBP, none on the other pawn bps.
Whenever I play everything appears to work fine. The line trace fires properly, it hits tv mesh, outlines it, and removes it when it isn’t being hit. Regardless I still receive this error each time I exit out.
Can’t figure out how to properly set this up without any errors. Apologies if my setup is inefficient. Any tips on making cleaner would also be greatly appreciated! My knowledge with blueprint has only scratched the surface so anything helps. Thank you!
You really need different blueprint to be outlined?
You can simplify this in 2 different ways:
- make parent blueprint that has “outline on/off” mechanics and can set its mesh to different models.
- make component that when dropped on actor can handle its outline to be shown. This is much more advanced/complicated that first.
to make it first way:
create interface that can hide/show outline.
add that interface to parent mesh
in interface make 2 functions: one that sets mesh of blueprint to desired model, another that can hide/show outline
Now hen you trace to any object of this type:
do as you are doing now, but instead of casting to blueprint class, do cast to interface, and then do “INTERFACE CALL” (should have yellow pin)
You should have working parent class with outline.
From that point you can do inherited blueprints of that parent class that ca do more than just outline.
Okay I believe I understand what you’re saying. I need to have different blueprints though. For quick testing purposes the TVs and their blueprints are all the same, but they will all have their own purpose and uses later on. The only mutual thing they will really have is that they’re able to be interacted with and display that by being highlighted.
With that in mind would it still be beneficial to build a parent BP even they will all have different purposes down the line?
Yes, you can always pack some common functionality in parent blueprint class.
For eg at some point you want them react to “explosion event”, so they kick self in desired direction ie. add impulse to self.
Without base class you need to implement it in each one blueprint class.
With parent base class you just add it there.
However there is much better method (for level designer is great, not so to program it).
use custom actor and scene components, then you can drop them on any actor (blueprint, mesh, light) to add functionality.
However interfacing them with parent actor needs some complicated code.