Wiki > AutoComplete TextField

AutoCompleteAttribute class


Attribute class that can be used to add AutoComplete logic to a string field without the need of a custom editor.

Namespace: RotaryHeart.Lib.AutoComplete
Package: AutoComplete TextField

Syntax


public class AutoCompleteAttribute : PropertyAttribute

Constructors


Accessibility Level Name Description
public AutoCompleteAttribute(string[]) Adds the array of string to be used for the dropdown.

Properties


Accessibility Level Type Name Description
public string[] Entries Array of string to be used by the dropdown.

Example

Here's a quick example of how to use the attribute.

#if UNITY_EDITOR
[AutoComplete(new string[] { "Entry 1", "Entry 2", "entry 3" })]
#endif
public string textField;

Note that we are using if UNITY_EDITOR since the array of entries is not needed for a built game.