Hi !
I need help to my little game. So… I made a script named “NPC” , it should show my little Dialogue Box. I don’t know the script to show the Dialogue, so please help me telling the script to show the Dialogue Box :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using UnityEngine.SceneManagement;
public class NPC : MonoBehaviour
{
public GameObject PutDialogue;
public GameObject PutPlayer;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Player")
{
StartCoroutine(Dialogue());
}
}
IEnumerator Dialogue()
{
yield return new WaitForSeconds(0.5f);
}
}
Can you see the “yield return new WaitForSeconds(0.5f);” ? Bellow this script line, I want to make a script that will show the Dialogue Box. Please help me !!!