Search Unity

In app search for content

Discussion in 'Immediate Mode GUI (IMGUI)' started by Argonxx, Jan 23, 2018.

  1. Argonxx

    Argonxx

    Joined:
    Apr 16, 2017
    Posts:
    37
    Hi! I am trying to do a simple app with some information. I want to use InputField and Search button to let user to search in the topics list for the interesting issue. For example, there will be about 30 different topics and I want to find something about lake. So, in the InputField I'm writing "lake" and it should find something about it from the list of 30 elements. And when I can see the result displayed below and I can press it to change the scene.
    Do you know how to make such a search?
    Do you know any free/not free (but cheap;)) asset for search in the app?
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You aee looking for some sort of custom control that provides a search field (with autocomplete support?) button and a list view.

    I am not familiar with an asset that does this, but it should be fairly simple to write it yourself.
     
  3. Argonxx

    Argonxx

    Joined:
    Apr 16, 2017
    Posts:
    37
    I am learning javascript but it's too early for me to write such a script. That's why I am looking for some asset.
     
  4. Argonxx

    Argonxx

    Joined:
    Apr 16, 2017
    Posts:
    37
    Ok, I found something but it is a search for a web page. So, I need to adapt it to the Unity, what meens change HTML reference to Unity reference.

    My table will looks like that:
    var products = new Array("Element","Product","Thing","Object");

    For example: this is a code for displaying information after search.
    Code (JavaScript):
    1. for ( var i = 0; i < rows.length; i++ ) {
    2.         var fullname = rows[i].getElementsByTagName("td"); //So, it referes to the table, made with browser coding with <td> <tr> etc. How can I make it refere to the table?
    3.         fullname = fullname[0].innerHTML.toLowerCase();
    4.         if ( fullname ) {
    5.             if ( v.length == 0 || (v.length < 3 && fullname.indexOf(v) == 0) || (v.length >= 3 && fullname.indexOf(v) > -1 ) ) {
    6.                 rows[i].style.display = "";
    7.                 on++;
    8.             } else {
    9.                 rows[i].style.display = "none";
    10.             }
    11.         }
    12.     }
    So, I will need something like that:
    function printResults(sortedResults) {
    var outputArea = document.getElementById("inputField");
    outputArea.innerHTML=""; - and here is reference to the HTML file. Can U tell me how to let it reference to the inputField?