Top.Mail.Ru
Ответы
Аватар пользователя
Аватар пользователя
Аватар пользователя
Программирование
+1

Ошибка на unity

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?)

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
 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<string> sentences; 
 
    private void Start(){ 
        sentences = new Queue<string>(); 
    } 
 
    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); 
    } 
} 
 
По дате
По рейтингу
Аватар пользователя
Мыслитель

Подключи библиотеку TMPro

Аватар пользователя
Просветленный

Попробуй поменять using UnityEngine.UI; на using TMPro;