I can´t find the error CS1022

So i have this Grounded script for my player and i can´t find the CS1022 Error.

    GameObject Player; {
    // Start is called before the first frame update
    void Start()
    {
        Player = GameObject.transform.parent.GameObject;
    }

    // Update is called once per frame
    void Update()
    {
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.tag == ("Ground"))
            Player.GetComponent<Move2D>().isGrounded = true;
    }
    private void OnCollisionExit2D(Collision2D collision)
    {
        if (collision.collider.tag == ("Ground"))
            Player.GetComponent<Move2D>().isGrounded = false;
        }

If anyone help me: pls help me :smile:

I can’t either. What is error CS1022? I don’t memorize error codes. Also, the error code usually points to a line, or a line close to the error.

I do see you have an { after GameObject Player; Not sure if it’s suppose to be connected to something, but it seems to be in an odd location.

1 Like

Always search on the error. This one is “Type or namespace definition, or end-of-file expected” and is indeed caused by the extra { at the top. Understanding why this is happening is important, so be sure you’re clear on that.

Compiler Error CS1022 | Microsoft Docs