I want to enable gravity for this object, (on line 28) but it says “An object reference is required for the non-static field, method, or property ‘UnityEngine.Rigidbody.useGravity.get’”. Here is the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pickup_cube : MonoBehaviour {
public bool holding;
void OnMouseDown()
{
holding = true;
}
void OnMouseUp()
{
holding = false;
}
void Update()
{
if(holding == true)
{
this.transform.SetParent(Camera.main.transform);
}
if(holding == false)
{
this.transform.parent = null;
Rigidbody.useGravity = true;
}
}
}