My method is an unexpected symbol?

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

public class DialogManager
{
    private GameObject name;
    public string speakerName;
    public GameObject startDialog;
    // Use this for initialization
    void Awake ()
    {
        //gets the character's Name
        speakerName = transform.parent.name;
        //changes the UI name to character's name
        name = GameObject.Find("Name");
        TextMeshProUGUI text = name.GetComponent<TextMeshProUGUI>();
        text.text = speakerName;
    }
    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown("enter")
            updateDialog("a");
    }
}
public void updateDialog(string choice)
{
    //GameObject.Find(i+choice);
    Debug.Log(i+choice);
}

I declared a method and I was attempting to use it in my update function, but its coming up as “Error unexpected symbol ‘updateDialog’” why is this “unexpected”?

I tried moving the method declaration outside of the scope of the class, I tried removing my counter to see if that helped, I double checked all of the braces. Still confused

You forgot to add another )
Look at the line :

if(Input.GetKeyDown("enter")

it should be :

if(Input.GetKeyDown("enter"))

Add another ) at the end

2 Likes