I'm new in unity, and I'm not good at scripting;
I just recognize there is a problem with
SetSelectedUIToDefault()
The error is nullreferenceexception
Thanks for helping me;
Here is script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// This class stores relevant information about a page of UI
/// </summary>
public class UIPage : MonoBehaviour
{
[Tooltip("The default UI to have selected when opening this page")]
public GameObject defaultSelected;
/// <summary>
/// Description:
/// Sets the selected UI selectable to the default defined by this UIPage
/// Inputs:
/// none
/// Returns:
/// void (no return)
/// </summary>
public void SetSelectedUIToDefault()
{
if (defaultSelected != null)
{
GameManager.instance.uiManager.eventSystem.SetSelectedGameObject(defaultSelected);
GameManager.instance.uiManager.eventSystem.SetSelectedGameObject(null);
}
}
}