Hello! I recently started programming and got this error message while trying to make a dialogue. I know that the problem comes from the type "string" of my variable but I don't know how to do otherwise here are the two codes: Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class dialogue { [TextArea(3, 10)] public string [] sentences; } Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class dialoguetriggerNPC1 : MonoBehaviour { public bool cantalk; public dialogue dialogue; private void Update() { if (cantalk && Input.GetKeyDown(KeyCode.E)) { TriggerDialogue(); } } private void OnTriggerEnter(Collider Collision) { if (Collision.CompareTag("Player")) { cantalk = true; } } private void OnTriggerExit(Collider collision) { if (collision.CompareTag("Player")) { cantalk = false; } } void TriggerDialogue() { FindObjectOfType<dialogueManager>().StartDialogue(dialogue); } } the error is at the end of the second script, in void TriggerDialogue, and more precisely in (dialogue) thank you in advance! and sorry if my english is bad
I'm assuming then the StartDialogue method is mistakenly asking for a dialogueManager parameter, rather than a dialogue parameter that you're giving it.
For future note, no one memorizes error codes. The error message you posted in comment #3 is very helpful, but just as helpful is the set of numbers in parenthesis that immediately follows the error message, as well as the name of the script the error occurs. The script file name is important, so we're looking at the correct file for the error. But the numbers in parenthesis go with that, where the 1st number is the line number the error occurs. All that info together lets anyone go exactly to the line in the code the compiler believes the error occurs. The actual problem is either on that line, or very close to it. Providing all that info just makes it really easy to help for anyone, and it doesn't cost you much extra time to provide. Just so you know, and you can use it yourself too for your own investigation. Good luck with your project.