A Problem of "gravity" :) A simple question

I have a scene with 2 objects in 2D named “Circle” and name “Square”.
Inside of Square, I put this script to change 2 attributes (color and gravity) of Circle object.

using UnityEngine;

public class Square : MonoBehaviour
{
       GameObject circulo;

    void Start()
    {
        circulo = GameObject.Find("Circle");
        circulo.GetComponent<Rigidbody2D>().gravityScale = 0.05f;
    }

      void Update()
    {
        if (Input.GetKey(KeyCode.Space))
        {
            circulo.GetComponent<SpriteRenderer>().color = Color.red;
            circulo.GetComponent<Rigidbody2D>().gravityScale = 0;
        }
    }
}

My problem is this: When I press “space key” Circle change color, but don’t change gravity (circle keeps moving to g = 0.05f).
But (and very strange), if inside of conditional, gravityScale=5, then changes ¿What’s going on?
Thank you! and I’m sorry by my english language.

I think what’s happening is that the gravityScale is indeed set to 0 but the velocity of the circle continues because it was previously under the effects of gravity. Try adding

circulo.GetComponent<Rigidbody2D>().velocity = Vector3.zero;

This should set the velocity to 0.
Also you should try setting your GetComponent Rigidbody2d and SpriteRenderer to a variable in Start for better performance.