Getting all actors of all classes

Hi guys.

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 time 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.

As long as they all the same type of BP, you should be able to add to array.

I know you do not want to use arrays, but if you store in the array and have the BP then store the array number

easy to retrieve.

Narg

Thank your for the answer RimmyD.

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 object, highlight it (which is already done) and recognizing what I clicked. Do you think is it possible?

I rather need names of classes for using GetAllActorOfClass.

Click on some object → Get their class name → Get all actors of that class → …

I don’t know C++ scripting, but I found it could be possibly by joining it with BPs. Am I right?

Is this the type of thing you are looking for?

38133-capture.jpg

Narg

Yes, but I want to Get All Actor Of Class which I’ll hover or click. So it should get display name at runtime after clicking.

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?

Thanks for your comment RimmyD.

I am able to get a reference to every object, but how can I do this with avoiding ‘Accessed none’. I want to have access also in level BP.

Generally I want to get access at runtime to the name of class whose object I click.

There are some screens and details if you want to help me :slight_smile:
https://answers.unrealengine.com/questions/206421/objects-selection.html

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 time 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:

  1. Unhighlight CurrentSelection if it is not null.
  2. Set the new hit actor to CurrentSelection
  3. Set the new CurrentSelection to be highlighted if it is not null.

Here’s a quick mockup in engine:

It is exactly what I needed!

I was trying with hit result, but I would do mistakes then. Glad that you’ve devoted your time for me.

Great thanks RimmerD :slight_smile:

Very glad it works for you :slight_smile:

You should accept the answer if it has been resolved :slight_smile:

I did it already and it was earlier… However I did it again :slight_smile: