Help with error please its telling me syntax error on if{ Input.GetKeyDown(KeyCode.Escape)} { DestroyObject(bomb); }

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

public class GMScript : MonoBehaviour
{
public GameObject bomb;//variable created for bomb
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
    if{ Input.GetKeyDown(KeyCode.Escape)}
     {
        DestroyObject(bomb);
     }

     
}
void DestroyObject(GameObject obj)//void is a function 
{
    Destroy(obj); 
}

}

If your if-statement is using curly-braces rather than regular brackets.

You can always google how certain syntax is meant to look: C# If ... Else

You have your post tagged as “2D-Graphics” but your post doesn’t relate to that. If you add the wrong tags, your post ends up in the wrong support area which in this case is 2D.

Please only use tags that relate to your issue, in this case “Scripting”. I’ll go ahead and change the tags for you.

Thanks.