Parsing Error help?

Anyone know what is wrong with this code. It says there is a parsing error on the last line?

using UnityEngine;
public class SphericalGravity : MonoBehaviour { float gravity = -9.8f;
	void Start ()
	{

	}

	void Update () 
	{
		Rigidbody.velocity += transform.position.normalized * gravity * Time.deltaTime;
	}

Let’s line things up a little better…

using UnityEngine;

public class SphericalGravity : MonoBehaviour 
{ 
    float gravity = -9.8f;

    void Start ()
	{

	}

	void Update () 
	{
		Rigidbody.velocity += transform.position.normalized * gravity * Time.deltaTime;
	}

Can you see what’s missing now? Always have to have matching braces.

Also, what is Rigidbody? Do you mean transform.velocity?

You’ve missed closing bracket “}” at the end of the script, also you can’t increase velocity of Rigidbody class…

Most likely you want something ~like that:

using UnityEngine;

public class SphericalGravity : MonoBehaviour
{
    float gravity = -9.8f;
    private Rigidbody rb;
    private void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }
    void Update()
    {
        rb.velocity += transform.position.normalized * gravity * Time.deltaTime;
    }
}

Also note that Unity already has gravity and you could play with that, without introducing the wheel, instead of increasing velocity of object to the speed of light in no time (that’s what your velocity increasing code will do), just in case you didn’t know. I have corrected only errors, not the concept, so be sure to note that.