Есть класc ObjectsInformation:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ObjectsInformation : MonoBehaviour
{
[Header("Build Name")]
public string BuildName;
[Header("Build Information")]
public int BlockCount;
public Difficult difficult;
[Header("Updates")]
public List<Updates> levelsUpdate = new List<Updates>();
[Header("NowLevel")]
public int Level;
public enum Difficult
{
Easy,
Normal,
Hard,
Very_Hard
};
private void Start()
{
GetComponentInChildren<Text>().text = BuildName;
if (Level == 0) transform.GetChild(2).GetComponent<Text>().text = "Построить";
else transform.GetChild(2).GetComponent<Text>().text = "Улучшить";
}
}
класс Update из которых состоит лист в ObjectsInformation:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[System.Serializable]
public class Updates
{
public int level;
public Image Image;
public GameObject Object;
}
Выдает NullReferenceException: Object reference not set to an instance of an object ObjectsInformation.Start () в
if (Level == 0) transform.GetChild(2).GetComponent<Text>().text = "Построить";
else transform.GetChild(2).GetComponent<Text>().text = "Улучшить";
Объясните в чем проблема пожалуйста...