x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to create a Search Bar

Hey Im trying to create a search bar (within game) which can search up different blueprints or objects based on their name. I'd really appreciate any help. Thanks!

Product Version: UE 4.16
Tags:
more ▼

asked Jun 04 '17 at 11:40 AM in Blueprint Scripting

avatar image

ZAINheroOFtime
1 1 1 3

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Here's how I would approach this:

  1. Create a widget that contains your searchbar

  2. Searchbar should be a textbox

  3. Use either text changed or text committed event to do one of the following things

A) If the objects you want to filter/find are children of the same class then just create an array of those objects at a convenient location (game instance for example).

B) if objects don't share a parent you can make them implement an interface that returns the property you are searching by (e.g. name). Of course you will put them into an array as well, but this time the array type should be of the interface

Subsequently on whatever event you are using (chosen in #3) you should iterate (forloop) over the array and check if your objects qualify for the search string. (E.g their name contains the text you entered in textbar)

Put the matching objects into a separate array and output them under the searchbar.

This is the theoretic part, unfortunately it is not possible to code or blueprint graph for this unless we know specifically what you are trying to do

more ▼

answered Jun 04 '17 at 07:06 PM

avatar image

Irakli
443 15 6 24

(comments are locked)
10|2000 characters needed characters left

This channel covered this search bar topic very well. I'd subscribe to him, he's actually pretty good. https://youtu.be/fEQF2EVGFSw

more ▼

answered Dec 04 '17 at 06:12 AM

avatar image

Tjtell
26 1 2

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question