UI Elements
Input Field Enhancer
A customizable input field extension
Overview
Input Field Enhancer upgrades a TextMeshPro input field with animated placeholder behavior. It supports slide, fade, and fade plus scale transitions. It also integrates with the Interactive system to synchronize visual states and supports submit events when pressing the enter key.
This page only covers the extension part. Click here to see the TMP Input Field documentation.
Properties
Settings
| Name | Type | Description |
|---|---|---|
animationType | PlaceholderAnimation | Animation used for placeholder (Fade, FadeScale, Slide) |
slideOffset | Vector2 | Offset applied when sliding placeholder |
fadeAlpha | float | Opacity of placeholder during animated state |
scaleMultiplier | float | Scale used when animating placeholder |
animationDuration | float | Duration of animation transition |
animationCurve | AnimationCurve | Curve for visual easing |
References
| Name | Type | Description |
|---|---|---|
source | TMP_InputField | Input field controlled by enhancer |
interactableObject | Interactive | Optional Interactive component for synced state transitions |
Events
| Name | Type | Description |
|---|---|---|
onSubmit | UnityEvent<string> | Invoked when pressing enter while editing |
Public Methods
| Name | Parameters | Description |
|---|---|---|
Focus() | None | Focuses and activates the input field, opening the keyboard or pointer caret |
Code Example
using UnityEngine;
using Evo.UI;
public class InputFieldEnhancerExample : MonoBehaviour
{
public InputFieldEnhancer enhancer;
void Start()
{
// Submit event
enhancer.onSubmit.AddListener(text =>
{
Debug.Log("Submitted: " + text);
});
// Manual focus
enhancer.Focus();
}
}