Unity InputField, Selectable NRE

Hey, guys here will be some useful info about exception I’ve figured out. It is in InputField component

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.Selectable.Select () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Selectable.cs:617)

and after that here bunch of this exceptions occured:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.InputField.ActivateInputFieldInternal () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/InputField.cs:2073)
UnityEngine.UI.InputField.LateUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/InputField.cs:639)

So reason was in EventSystem. I disable it for some reason with this code:

eventSystem.enabled = false;

To fix issue instead of disabling EventSystem do disable current input module:

eventSystem.currentInputModule.enabled = false;

Понравилась статья? Поделиться с друзьями:
Автор snezhok_13
Время от времени пишет статьи о разработке игр и проводит интервью с разработчиками. Сейчас работает engine-progremmer'ом в Larian Studios. Большой поклонник игр Naughty Dog.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *