-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
TMP_InputFieldOnSubmitEvent.cs
24 lines (22 loc) · 1.01 KB
/
TMP_InputFieldOnSubmitEvent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using TMPro;
using UnityEngine;
namespace TextToTMPNamespace
{
/// <summary>
/// This component is attached to upgraded InputField components with non-empty "On Submit" events. TMP_InputField component doesn't allow serializing
/// the On Submit event so this component acts as a bridge for the On Submit event between legacy InputField and TMP_InputField.
/// If you delete this script, any TMP_InputField with this component attached will have their On Submit event stop functioning (see: https://github.com/yasirkula/UnityTextToTextMeshProUpgradeTool#known-limitations)
/// </summary>
[DefaultExecutionOrder( -1000 )]
[RequireComponent( typeof( TMP_InputField ) )]
[DisallowMultipleComponent]
[HelpURL( "https://github.com/yasirkula/UnityTextToTextMeshProUpgradeTool#known-limitations" )]
public class TMP_InputFieldOnSubmitEvent : MonoBehaviour
{
public TMP_InputField.SubmitEvent onSubmit = new TMP_InputField.SubmitEvent();
private void Awake()
{
GetComponent<TMP_InputField>().onSubmit = onSubmit;
}
}
}