Error 1:Assets\Dialogue Manager.cs(8,22): error CS1002: ; expected
Error 2:Assets\Dialogue Manager.cs(8,25): error CS1519: Invalid token ';' in class, record, struct, or interface member declaration.
I don't know how to fix them, I'm still really new to C#
this is which tutorial I was following:
link:https://youtu.be/WBH4LecZCwE
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DialogueManager : MonoBehaviour
{
public float NPC npc;
bool isTalking = false;
float distance;
float curResponseTracker = 0;
public GameObject Player;
public GameObject dialogueUI;
public Text npcName;
public Text npcDialogueBox;
public Text playerResponse;
// Start is called before the first frame update
void Start()
{
dialogueUI.SetActive(false);
}
void OnMouseOver()
{
distance=Vector3.Distance(Player.transform.position,this.transform.position);
if (distance <= 2.5f)
{
if (Input.GetKeyCodeDown(KeyCode.E) && isTalking == false)
{
StartConversation();
}
else if (Input.KeyDown(KeyCode.E)&& isTalking == true)
{
LeaveConversation();
}
}
}
void StartConversation()
{
isTalking = true;
curResponseTracker = 0;
dialogueUI.SetActive(true);
npcName.text = NPC.name;
npcDialogueBox.text = NPC.dialogue[0];
}
void LeaveConversation()
{
isTalking = false;
dialogueUI.SetActive(false);
}
}
`
↧