Im making a game where i spawn different levels, containing a lot of different actors.
This is all based on the Collaborative Viewer template Unreal has.
I currently have a Data Table that extracts information whenever i click on an actor. The actor name is added to the data table, and i have an widget that extracts that data whenever i click on the actor and display the information i have added to the Data Table.
Now the question is: I want to add an search feature. Where i can search for an specific actor i have spawned. The search feature then needs to be based on this data table, whenever i have searched for the actor and clicked on the result, i want the actor to be highlighted.
How can i implement this? Im kinda new to Unreal Blueprinting, and dont have any experience using coding…
I have seen many tutorials on how to add search bars, but they dont search through spawned actors, it is only based on data they have added themselves…
Thanks!
How it looks like with the information displaying:
Im gonna search for the Actors name based on what Actors are currently in the scene. Since these already are listed in my Data Table, i thought i could use the data table as reference. So whenever it finds the name of the Actor in the Data Table, and it is spawned in the scene, the Actor will be highlighted. For example, i have spawned an Actor that contains many static meshes, the actors name is “Bull”, whenever i search for “Bull” and click on the result, the “Bull” will be highlighted. This actor already is in my datable, that contains the information i showed in the image in my post.
For now, c++ is not an option. However, if i dont find any solution, i have to use it (even though i have very little experience in c++)
When i think about it, Data Table isnt really needed. I thought it would be “easier” to use since the Actors name are already there, and searching through a data table would be easier in practice for blueprints, rather that spawned Actors.
How would it look like on blueprints/widgets?
Could you explain more how this would work?
There are a lot of detailed 3D models, so perfomance is very important.
A digital tree? I might have misunderstood what OP wants then.
whenever i have searched for the actor and clicked on the result, i want the actor to be highlighted. […] Where i can search for an specific actor i have spawned.
I was thinking along the lines of simply finding something in the scene based on its name.
@haugz When you start typing and search for actors with similar names, do you want all whose partially match the search criteria to highlight? Imagine there’s 600 actors:
Even though I only partially matched, I get a filtered result. Is this what we’re doing? Or more like this:
We still do not know what you need as I posted 2 separate things above. If you want the thing with the red boxes, do refer to my script couple of post above.
My bad, kinda hard to explain what i need without knowing Unreal that well.
I am spawning the Actors in a different method, im trying out you first suggestion, using the editable text and finding the actors, but dont know how to add those nodes.
Lets just forget about Data Tables, if that is harder to use…
This is an example of what i need when the actors are already spawned:
Pretty straighforward, you could associate tags/names structs full of actor/component references array. Either use a map to make it efficent or look up tags dynamically - can get slow if you have a lot of stuff or target paltform is a potato.
What I posted would work well. The DT is just for spawning things: it’s static, so it cannot hold references to instances anyway.
You can always search for the keywords that were mentioned and give it a go:
Small status…
I made this work, working with maps is quite tricky but does pay off.
I may use this as the new spawning mechanic.
However, no i have come to the point where if i search and it does match, i need it to highlight. Tried looking up online, but couldnt find any good outline results based on this.
Saw previous answer had an “BPI global pause” node, but couldnt find that.
So how can i highlight the class actor i have successfully matched on the editable text?
It was an example of an interface call, it’s custom - you need to write it and implement it from scratch for you project. Look into how interface messages work.
In short:
the interface has a function allowing you to call it on actor instances that implement it
actor classes are given the interface and then implement the function
store the reference to the most recently highlighted actor so it can be removed
when new actors need highlighting, remove the old highlight, show the new one
The whole thing can be done without an interface if your actors/compoennts are the same class or you use robust inheritance.