So I’ve created canvas prefab and need to instantiate it in runtime. When I do so, I cannot navigate through buttons in canvas. However, It works perfectly fine when I put it in the scene and hit play.
Is there any canvas initialization I am missing here?
Have you got an Event system in your scene?
Here is my solution:
[SerializeField] GameObject m_firstSelected = null;
private void Start()
{
EventSystem.current.SetSelectedGameObject(m_firstSelected);
}
Do not call it from inside Awake method, it might met race condition, and hit null at EventSystem.current.