unity-game-engine

From which Unity version was the InputField.onSubmit event introduced?


I'm currently using Unity 2018.2.7f1, and I wanted to use the InputField.onSubmit event, but I can't seem to find it in this version.

After checking the Unity documentation and searching for solutions, it seems that the onSubmit event was introduced in an earlier version, but I’m not sure exactly which version it was.

Could someone clarify from which version of Unity the InputField.onSubmit event became available? If it's not supported in Unity 2018.2.7f1, is there a workaround to achieve the same functionality in this version?

Thanks in advance!


Solution

  • Since Unity 2019.2 the entire UnityEngine.UI was moved to a package which is by default pre-installed.

    There definitely already exists onSubmit as an event.

    Up until version 2019.1 it doesn't appear in the API at least (which doesn't necessarily mean it didn't exist - but it is quite probable that not)


    In general your version 2018.2.7f1 is from September 6, 2018!

    On longer ongoing projects you should definitely try and regularly keep up with the latest LTS version (currently 2022.3.8). Be aware that jumping now might of course come with some issues and changed APIs - but it is still worth doing some incremental upgrades. Yet alone because of performance improvements and bug fixes etc.


    Also in general the text related components from UnityEngine.UI (Text, InputField (which uses Text), Dropdown etc) are also legacy now. You should switch over to TextMeshPro and according TMP_Inputfield.