How to get object reference using c++?

Hi guys,

So I have a situation where I put hundreds of objects(cubes) into the scene. I randomly drop the player from the sky and it lands on one of those cubes. My task is:

1.Find the reference of an object I have landed on.

2.Find the reference of objects(cubes) around me.

But I dont know what is the function to get reference of an object, can aybody help me? Or maybe there is better approach to this tasks?

Thank you

There are quite a few ways to find references of actors so I will just make a list

You could also expose a field using

UPROPERTY(EditAnywhere)
class AActor* SelectedActor;

and just manually set the reference this way, but it is probably not applicable for you.

1 Like

Thanks, Iā€™m gonna try to use traces.