I have a lot of meshes on my scene and i need to click on them and get name of clicked mesh to insert in uri. What is the best way to do this?
p.s. it’s not a good idea for me, creating a blueprint class with references to each one of this objects, because it is possible to add new meshes in future.
Try again to explain, I am unsure what you want to do.
There are nodes: get all actors of class, and get all actors with interfaces.
You can also get all actors of class (static mesh) and check their tags, but for that you need to painfully fill up all tags and do not misspell.
But all that is guessing since i fail to get what you need.
You could also create scene component, then add it to meshes you want to interact later. All what that component should do is to get parent reference, and then add it to some array in for eg game state blueprint. This way you could get list of all actors you want.
Thanks for you reply:)
Well, I’m a little moved on)
What am I do for now - is getting all actors of class (static mesh actor), then I subscribe all of them to OnClickedEvent. And what am I want to know - how to pass clicked object to get display name?
Like Orkney said, use “GetHitResultUnderCursorByChannel”.
On the PlayerController, listen to the mouse click.
When the player clicks, use a “GetHitResultUnderCursorByChannel” node and break its hit result. You will have access to the “HitActor” reference of this hit result. You can simply print the Name of the actor hit afterwards (or use it however you want).
Make sure you have every collision stuff set up to work properly (basically the hit actor should block the collision channel used by your “GetHitResultUnderCursorByChannel” node).