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);
}
}
}