Assets\Dialouge\DialougeMenager.cs(118,9): error CS0030:Cannot convert type 'Choise' to 'Ink.Runtime

I was following a how to make a dialouge system tutorial and a message: Assets\Dialouge\DialougeMenager.cs(118,9): error CS0030: Cannot convert type ‘Choise’ to ‘Ink.Runtime.Choices’ kept popping up. Does anyone know how to fix that?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Ink.Runtime;

public class DialougeMenager : MonoBehaviour
{

    [Header("Dialouge UI")]
    [SerializeField] private GameObject dialougePanel;

    [SerializeField] private TextMeshProUGUI dialogueText;

    [Header("Choices UI")]
    [SerializeField] private GameObject[] choices;
    private TextMeshProUGUI[] choicesText;

    private Story currentStory;

    public bool dialogueIsPlaying;

    private static DialougeMenager instance;

    private void Awake()
    {
        if (instance != null)
        {
            Debug.Log("More than 1 Dialouge Menager in the scene!");
        }
        instance = this;
    }

    public static DialougeMenager GetInstance()
    {
        return instance;
    }

    // Start is called before the first frame update
    void Start()
    {
        dialogueIsPlaying = false;
        dialougePanel.SetActive(false);

        //get all of the choises text
        choicesText = new TextMeshProUGUI[choices.Lenght];
        int index = 0;
        foreach (GameObject choice in choices)
        {
            choicesText[index] = choice.GetComponentInChildren<TextMeshProUGUI>();
            index++;
        }
    }

    // Update is called once per frame
    void Update()
    {
        //return right away if dialouge is playing
        if (!dialogueIsPlaying)
        {
            return;
        }

        //handle continuing to the next line of the dialouge if E was pressed
        if (Input.GetKeyDown(KeyCode.E))
        {
            ContinueStory();
        }
    }

    public void EnterDialougeMode(TextAsset inkJSON)
    {
        currentStory = new Story(inkJSON.text);
        dialogueIsPlaying = true;
        dialougePanel.SetActive(true);

        ContinueStory();

    }

    public IEnumerator ExitDialougeMode()
    {
        yield return new WaitForSeconds(0.2f);

        dialogueIsPlaying = false;
        dialougePanel.SetActive(false);
        dialogueText.text = "";
    }

   private void ContinueStory()
    {
        if (currentStory.canContinue)
        {
            //text for the current dialouge line
            dialogueText.text = currentStory.Continue();
            //display choices, if any, for this dialouge line
            DisplayChoices();
        }
        else
        {
            StartCoroutine(ExitDialougeMode());
        }

    }

    private void DisplayChoices()
    {
        List<Choise> currentChoices = currentStory.currentChoices;

        //defensive chck to make sure the UI can support number of choices coming in
        if (currentChoices.Count > choices.Length)
        {
            Debug.LogError("More choices were given than the UI can support! Number of choices given:" + currentChoices.Count);
        }

        int index = 0;
        //connects the number of choices in the UI to the INK story file
        foreach(Choice choice in currentChoices)
        {
            choices[index].gameObject.SetActive(true);
            choicesText[index].text = choice.text;
            index++;
        }
        //go through the remaining choices and make sure they are hidden
        for (int i = index; i < choices.Length; i++)
        {
            choices[i].gameObject.SetActive(false);
        }
    
    }

}

nvm fellas i got it

Welcome to the club Bim

Cannot convert type ‘Choise’ to ‘Ink.Runtime.Choices’

looks like you’ve 69’d yourself into a typo

1 Like

Excellent. For future reference here is how you can fix your own errors:

The complete error message contains everything you need to know to fix the error yourself.

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)
  • also possibly useful is the stack trace (all the lines of text in the lower console window)

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

Look in the documentation. Every API you attempt to use is probably documented somewhere. Are you using it correctly? Are you spelling it correctly?

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.

Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.