No overload for method `Move' takes `1' arguments

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DialogueManager : MonoBehaviour {
public static DialogueManager Instance { get; set; }

public List<string> dialogueLines = new List<string>();
public string npcName;
public GameObject dialoguePanel;

void Awake () {
	if (Instance != null && Instance != this) {
		Destroy (gameObject);
	} 
	else 
	{
		Instance = this;
	}
}
public void AddNewDialogue(string[] lines, string npcName)
{
	dialogueLines = new List<string>();
	foreach (string line in lines) 
	{
		dialogueLines.Add(line);
	}

	this.npcName = npcName;
	Debug.Log (dialogueLines.Count);
}

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NPC : Interactable {
public string dialogue;
public string Name;

public override void Interact()
{
	DialogueManager.Instance.AddNewDialogue(dialogue); //getting error here
	Debug.Log ("Interacting with NPC.");
}

}

Hello there,

You call “AddNewDialogue” by passing in your variable “dialogue”, but the function is expecting TWO arguments, not ONE. It expects an array of strings called “lines”, as well as a string called “npcName”.

The fix would be to pass in your NPC name as well as the dialogue:

DialogueManager.Instance.AddNewDialogue(dialogue, myNpcName);

I hope that helps!

Cheers,

~LegendBacon

Bacon missed that the first ‘string’ is a ‘string array’ and not just a string.

I have made an explanation of Overloads here applied to ‘Instantiate’ but the reasoning is the same.

In a nutshell, arguments to a Function must match exactly in type.

When you call a function (or Invoke) you do not repeat the arguments as they are written in the constructor, for their name… you simply feed in what it wants according to type… it can be from ANY similarly typed variable. If you dont quite understand this you could look at it here .

~

There is also a wealth of information to be found :

Functions with Arguments