Class ModularInputField
- Namespace
- Fallencake.UI
- Assembly
- Fallencake.UI.dll
Modular wrapper over TMPro.TMP_InputField that adds animation hooks, audio feedback via IInputFieldAudioProvider and convenient submit handling.
[RequireComponent(typeof(TMP_InputField))]
public class ModularInputField : MonoBehaviour, IInputFieldAudioProvider, IAudioProvider
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourModularInputField
- Implements
Fields
OnSubmitEvent
public UnityEvent OnSubmitEvent
Field Value
- UnityEvent
Properties
AudioSource
AudioSource used to play sounds.
public AudioSource AudioSource { get; set; }
Property Value
- AudioSource
Component
Owning component used by handlers for context and coroutines.
public MonoBehaviour Component { get; }
Property Value
- MonoBehaviour
DeselectSound
Sound played on deselect.
public AudioData DeselectSound { get; }
Property Value
EnableSounds
Enables/disables sound playback for this component.
public bool EnableSounds { get; set; }
Property Value
- bool
EndEditSound
Sound for end-edit/submit.
public AudioData EndEditSound { get; }
Property Value
PressSound
Sound played on press/submit.
public AudioData PressSound { get; }
Property Value
SelectSound
Sound played on select/hover.
public AudioData SelectSound { get; }
Property Value
Selectable
UI selectable to bind event triggers to.
public Selectable Selectable { get; }
Property Value
- Selectable
TypeSound
Sound for character typing.
public AudioData TypeSound { get; }
Property Value
UseDeselectSound
Enables deselect sound playback.
public bool UseDeselectSound { get; set; }
Property Value
- bool
UsePressSound
Enables press sound playback.
public bool UsePressSound { get; set; }
Property Value
- bool
UseSelectSound
Enables select sound playback.
public bool UseSelectSound { get; set; }
Property Value
- bool
Volume
Per-component volume multiplier.
public float Volume { get; set; }
Property Value
- float
Methods
Deselect()
Triggers deselect animation if field is empty (placeholder visible).
public void Deselect()
Dispose()
Disposes internal audio handler and releases resources.
public void Dispose()
OnDeselect(BaseEventData)
Called by the EventSystem when a new object is being selected.
public void OnDeselect(BaseEventData eventData)
Parameters
eventDataBaseEventData
OnPointerClick(PointerEventData)
Use this callback to detect clicks.
public void OnPointerClick(PointerEventData eventData)
Parameters
eventDataPointerEventData
OnSelect(BaseEventData)
public void OnSelect(BaseEventData eventData)
Parameters
eventDataBaseEventData
OnSubmit(BaseEventData)
public void OnSubmit(BaseEventData eventData)
Parameters
eventDataBaseEventData
PlayDeselectSound()
public void PlayDeselectSound()
PlayPressSound()
public void PlayPressSound()
PlaySelectSound()
public void PlaySelectSound()
PlayTextInputSound()
Plays a text input sound if enabled and clip is assigned.
public void PlayTextInputSound()
Select()
Triggers select animation if field is empty (placeholder visible).
public void Select()
UpdateInteractable(bool)
Updates interactivity for the input field and audio handler.
public void UpdateInteractable(bool isInteractable)
Parameters
isInteractableboolTarget interactable state.
UpdateStateInstant()
Waits for animator initialization and applies instant state to match current text.
public IEnumerator UpdateStateInstant()
Returns
- IEnumerator