Autocomplete

Note

Difference between Autocomplete, AutoCombobox, and AutocompleteCombobox:
- Autocomplete is InputField with autocomplete feature.
- AutoCombobox is Combobox with the option to select items by typing, with it you can get selected items.
- AutocompleteCombobox is a wrapper for Autocomplete with the ability to select an action when user input is not valid.

Options

  • Input Field InputField

    Input field.

  • Target List View TListView

    ListView to display available values.

  • Display List View TListView

    Selected value will be added to this ListView.

  • Allow Duplicate bool

    TargetListView can have duplicated items.

  • Data Source List<TValue>

    List of the all values.

  • Filter AutocompleteFilter

    Filter settings.

    • Startswith

      Value should starts with the specified input.

    • Contains

      Value should contains with the specified input.

  • Case Sensitive bool

    Is filter case sensitive?

  • Delimiter Chars char[]

    Delimiter chars to split input to the words.

  • Input Type AutocompleteInput

    Filter with the current word or the whole input.

    • Word

    • AllInput

  • Result AutocompleteResult

    What to do with input after value selected.

    • Append

    • Replace

  • Min Length int

    Minimal length of the input to start search.

  • Search Delay float

    The delay in seconds between when a keystroke occurs and when a search is performed.

  • Unscaled Time bool

    Delay with unscaled time.

  • ResetListViewSelection bool

    Deselect selected items in the DisplayListView.

  • AllowCancelOnDeselect Func<BaseEventData, AutocompleteCustom<TValue, TListViewComponent, TListView>, bool>

    Allow to cancel DisplayListView close on deselect event.

Events

  • OnOptionSelected UnityEvent

  • OnOptionSelectedItem UnityEvent<TValue>

  • OnItemNotFound UnityEvent<string>

  • OnCancelInput UnityEvent

  • OnSearchCompleted UnityEvent

  • OnShowOptions UnityEvent<AutocompleteCustom<TValue, TListViewComponent, TListView>>

  • OnHideOptions UnityEvent<AutocompleteCustom<TValue, TListViewComponent, TListView>>

namespace UIWidgets.Examples
{
   using UIWidgets;
   using UnityEngine;

   public class AutocompleteIconsText: MonoBehaviour
   {
      [SerializeField]
      public AutocompleteIcons Autocomplete;

      [SerializeField]
      ListViewIconsItemDescription item;

      void Start()
      {
         Autocomplete.OnOptionSelectedItem.AddListener(SetItem);
      }

      void OnDestroy()
      {
         Autocomplete.OnOptionSelectedItem.RemoveListener(SetItem);
      }

      void SetItem(ListViewIconsItemDescription newItem)
      {
         item = newItem;
      }
   }
}