this is my code. i want to change swap gravity after pressing the space bar . can u look for errors ? cuz i cannot see any .this is 2d game [closed]


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

public class gravity : MonoBehaviour
{
    private Rigidbody2D rb;
    {
    void Start()
    {
        rb = GetComponent<Rigidbody2D>;
    }

    void Update
    {
        if(Input.GetKeyDown(KeyCode.Space))
        {
        rb.graityScale *= -1;
        }
    

}