我知道很多人已经问过这个问题,但即使我积极寻找并试验我见过或使用过的多种类型的代码,我似乎也无法修复错误。我想要实现的是,当我进入房间时,对话系统会自动弹出。这是我的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class McroomDialogueTrigger : MonoBehaviour
{
public McRoomDialogue dialogue;
// Start is called before the first frame update
void Start()
{
TriggerDialogue();
}
public void TriggerDialogue()
{
FindObjectOfType<McroomDialogueManager>().StartDialogues(dialogue);
}
}
这是出现错误的代码脚本。我之前在游戏的第一个场景中使用过这个,只是在这个场景中使用了不同的变量。另一个一开始没有工作,我把它放了一秒钟,突然就没事了。我很困惑,请你们帮帮我,我将非常感激。