using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class breed : MonoBehaviour
{
    public AudioSource Right;

    public Text button1;
    public Text button2;
    public Text button3;
    public Text button4;

    public Image ColorButton1;
    public Image ColorButton2;
    public Image ColorButton3;
    public Image ColorButton4;

    public static string answer;
    public static int i;

    public static string[] fruits = new string[39];

    void Start()
    {
        //Массив с породами
        fruits[0] = "Абби (0)";
        fruits[1] = "Азавак (1)";
        fruits[2] = "Бастер (2)";
        fruits[3] = "Белорусская овчарка (3)";
        fruits[4] = "Бигль (4)";
        fruits[5] = "Бладхаунд (5)";
        fruits[6] = "Бультерьер (6)";
        fruits[7] = "Винни (7)";
        fruits[8] = "Восточно-сибирская лайка (8)";
        fruits[9] = "Гриндель (9)";
        fruits[10] = "Далматин (10)";
        fruits[11] = "Дворняга (11)";
        fruits[12] = "Джек-Рассел терьер (12)";
        fruits[13] = "Западно-сибирская лайка (13)";
        fruits[14] = "Золотой Ретривер (14)";
        fruits[15] = "Керри-блю-терьер (15)";
        fruits[16] = "Колли (16)";
        fruits[17] = "Комондор (17)";
        fruits[18] = "Корги (18)";
        fruits[19] = "Корейский шпиц (19)";
        fruits[20] = "Лхаса апсо (20)";
        fruits[21] = "Неаполитанский мастиф (21)";
        fruits[22] = "Немецкая овчарка (22)";
        fruits[23] = "Овчарка (23)";
        fruits[24] = "Парсон-рассел-терьер (24)";
        fruits[25] = "Пти-брабансон (25)";
        fruits[26] = "Русская гончая (26)";
        fruits[27] = "Русская пегая гончая (27)";
        fruits[28] = "Русская псовая борзая (28)";
        fruits[29] = "Русский черный терьер (29)";
        fruits[30] = "Русско-европейская лайка (30)";
        fruits[31] = "Сахалинский хаски (31)";
        fruits[32] = "Сиба-ину (32)";
        fruits[33] = "Сибирский хаски (33)";
        fruits[34] = "Чау-чау (34)";
        fruits[35] = "Шелти (35)";
        fruits[36] = "Японский хин (36)";
        fruits[37] = "Японский шпиц (37)";
        fruits[38] = "Японский шпиц (37)";


        //Выбор правильного ответа
        button1.text = fruits[Random.Range(0, fruits.Length)];
        button2.text = fruits[Random.Range(0, fruits.Length)];
        button3.text = fruits[Random.Range(0, fruits.Length)];
        button4.text = fruits[Random.Range(0, fruits.Length)];

        //На какой кнопке будет правильный ответ
        i = Random.Range(1, 4);


        //Присваивание текста к кнопкам
        switch (i)
        {
            case 1:
                answer = button1.text;
                break;
            case 2:
                answer = button2.text;
                break;
            case 3:
                answer = button3.text;
                break;
            case 4:
                answer = button4.text;
                break;
        }
    }

    void Update()
    {
        //Сравнивание ответа и выбора
        if(NextPage.b == i)
        {
            OnClick();
            ColorButton1.color = new Color(0.466f, 0.584f, 0.313f, 1f);
            ColorButton2.color = new Color(0.466f, 0.584f, 0.313f, 1f);
            ColorButton3.color = new Color(0.466f, 0.584f, 0.313f, 1f);
            ColorButton4.color = new Color(0.466f, 0.584f, 0.313f, 1f);

            Right.Play();
        }
    }

    public void OnClick()
    {
        //Выбор правильного ответа
        button1.text = fruits[Random.Range(0, fruits.Length)];
        button2.text = fruits[Random.Range(0, fruits.Length)];
        button3.text = fruits[Random.Range(0, fruits.Length)];
        button4.text = fruits[Random.Range(0, fruits.Length)];

        //На какой кнопке будет правильный ответ
        i = Random.Range(1, 4);


        //Присваивание текста к кнопкам
        switch (i)
        {
            case 1:
                answer = button1.text;
                break;
            case 2:
                answer = button2.text;
                break;
            case 3:
                answer = button3.text;
                break;
            case 4:
                answer = button4.text;
                break;
        }
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class random : MonoBehaviour
{
    public static string DogsImg;


    void Update()
    {
        DogsImg = breed.answer;
        Image image = GetComponent<Image>();
        Sprite newSprite = null;

        //Выбор картинки отображения
        switch (DogsImg)
        {
            case "Абби (0)":
                newSprite = (Sprite)Resources.Load("dog (0)");
                break;
            case "Азавак (1)":
                newSprite = (Sprite)Resources.Load("dog (1)");
                break;
            case "Бастер (2)":
                newSprite = (Sprite)Resources.Load("dog (2)");
                break;
            case "Белорусская овчарка (3)":
                newSprite = (Sprite)Resources.Load("dog (3)");
                break;
            case "Бигль (4)":
                newSprite = (Sprite)Resources.Load("dog (4)");
                break;
            case "Бладхаунд (5)":
                newSprite = (Sprite)Resources.Load("dog (5)");
                break;
            case "Бультерьер (6)":
                newSprite = (Sprite)Resources.Load("dog (6)");
                break;
            case "Винни (7)":
                newSprite = (Sprite)Resources.Load("dog (7)");
                break;
            case "Восточно-сибирская лайка (8)":
                newSprite = (Sprite)Resources.Load("dog (8)");
                break;
            case "Гриндель (9)":
                newSprite = (Sprite)Resources.Load("dog (9)");
                break;
            case "Далматин (10)":
                newSprite = (Sprite)Resources.Load("dog (10)");
                break;
            case "Дворняга (11)":
                newSprite = (Sprite)Resources.Load("dog (11)");
                break;
            case "Джек-Рассел терьер (12)":
                newSprite = (Sprite)Resources.Load("dog (12)");
                break;
            case "Западно-сибирская лайка (13)":
                newSprite = (Sprite)Resources.Load("dog (13)");
                break;
            case "Золотой Ретривер (14)":
                newSprite = (Sprite)Resources.Load("dog (14)");
                break;
            case "Керри-блю-терьер (15)":
                newSprite = (Sprite)Resources.Load("dog (15)");
                break;
            case "Колли (16)":
                newSprite = (Sprite)Resources.Load("dog (16)");
                break;
            case "Комондор (17)":
                newSprite = (Sprite)Resources.Load("dog (17)");
                break;
            case "Корги (18)":
                newSprite = (Sprite)Resources.Load("dog (18)");
                break;
            case "Корейский шпиц (19)":
                newSprite = (Sprite)Resources.Load("dog (19)");
                break;
            case "Лхаса апсо (20)":
                newSprite = (Sprite)Resources.Load("dog (20)");
                break;
            case "Неаполитанский мастиф (21)":
                newSprite = (Sprite)Resources.Load("dog (21)");
                break;
            case "Немецкая овчарка (22)":
                newSprite = (Sprite)Resources.Load("dog (22)");
                break;
            case "Овчарка (23)":
                newSprite = (Sprite)Resources.Load("dog (23)");
                break;
            case "Парсон-рассел-терьер (24)":
                newSprite = (Sprite)Resources.Load("dog (24)");
                break;
            case "Пти-брабансон (25)":
                newSprite = (Sprite)Resources.Load("dog (25)");
                break;
            case "Русская гончая (26)":
                newSprite = (Sprite)Resources.Load("dog (26)");
                break;
            case "Русская пегая гончая (27)":
                newSprite = (Sprite)Resources.Load("dog (27)");
                break;
            case "Русская псовая борзая (28)":
                newSprite = (Sprite)Resources.Load("dog (28)");
                break;
            case "Русский черный терьер (29)":
                newSprite = (Sprite)Resources.Load("dog (29)");
                break;
            case "Русско-европейская лайка (30)":
                newSprite = (Sprite)Resources.Load("dog (30)");
                break;
            case "Сахалинский хаски (31)":
                newSprite = (Sprite)Resources.Load("dog (31)");
                break;
            case "Сиба-ину (32)":
                newSprite = (Sprite)Resources.Load("dog (32)");
                break;
            case "Сибирский хаски (33)":
                newSprite = (Sprite)Resources.Load("dog (33)");
                break;
            case "Чау-чау (34)":
                newSprite = (Sprite)Resources.Load("dog (34)");
                break;
            case "Шелти (35)":
                newSprite = (Sprite)Resources.Load("dog (35)");
                break;
            case "Японский хин (36)":
                newSprite = (Sprite)Resources.Load("dog (36)");
                break;
            case "Японский шпиц (37)":
                newSprite = (Sprite)Resources.Load("dog (37)");
                break;
        }
        image.sprite = newSprite;
    }
}
В чем ошибка?