I am wondering if is it possible to get all actors of all existing classes based on actors? I have created a few blueprint classes with just a single mesh inside and in my level BP I want to have control on every meshes.
I was trying for a long but I don’t have an idea… Maybe you have?
This simplest method to fit your pipeline would probably be to create an interface and assign it to all of your blueprints. Then you can use GetAllActorsWithInterface.
There may be a better way to do what you are attempting but with the given info this is my recommendation.
I was thinking about interfaces and it is some option instead of creating an array with every classes. But then I have an access to Array of Actor References which is good, but I rather need something like GetClassByName and I could join it with that array.
I want to click on , highlight it (which is already done) and recognizing what I clicked. Do you think is it possible?
Well when clicking on something you should pretty easily be able to get a pointer to it. Is there some reason you need a pointer to everything that exists?
I feel like you’ve gotten down an odd path, I will detail out how i would handle this issue and let me know if it applies.
You could put this functionality in your level or player controller/etc. Don’t handle this per blueprint actor as that is messy, you do not want every single blueprint in the level doing a hit test every the mouse is clicked. Instead handle this entirely in one spot such as the player controller or level blueprint.
Have a variable called CurrentSelection that is of type Actor.
Create an input event for LeftMouseButton and have it do a hit test under the mouse cursor. The trace will return any actor beneath the mouse cursor. Pass this actor into a function HandleSelection.
In HandleSelection you need to:
Unhighlight CurrentSelection if it is not null.
Set the new hit actor to CurrentSelection
Set the new CurrentSelection to be highlighted if it is not null.