Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Ошибка на unity

Павел Катышев Знаток (299), на голосовании 1 месяц назад
Assets\scripts\Dialogue\DialogueManager.cs(8,12): error CS0246: The type or namespace name 'TextMeshProUGUI' could not be found (are you missing a using directive or an assembly reference?)
 using System.Collections; 
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DialogueManager : MonoBehaviour
{
public TextMeshProUGUI dialogueText;
public TextMeshProUGUI nameText;

public Animator boxAnim;
public Animator startAnim;

public Queue sentences;

private void Start(){
sentences = new Queue();
}

public void StartDialogue(Dialogue dialogue)
{
boxAnim.SetBool("boxOpen", true);
startAnim.SetBool("startOpen", false);

nameText.text = dialogue.name;
sentences.Clear();

foreach(string sentence in dialogue.sentences)
{
sentences.Enqueue(sentence);
}
DisplayNextSentense();
}

public void DisplayNextSentense()
{
if(sentences.Count == 0)
{
EndDialogue();
return;
}
string sentence = sentences.Dequeue();
StopAllCoroutines();
StartCoroutine(TypeSentence(sentence));
}

IEnumerator TypeSentence(string sentence)
{
dialogueText.text = "";
foreach(char letter in sentence.ToCharArray())
{
dialogueText.text += letter;
yield return null;
}
}

public void EndDialogue()
{
boxAnim.SetBool("boxOpen", false);
}
}
Голосование за лучший ответ
Лев Перфилов Гуру (4521) 2 месяца назад
Попробуй поменять using UnityEngine.UI; на using TMPro;
Похожие вопросы