AddTorque is not working.

using UnityEngine;
using System.Collections;

public class CONTROL : MonoBehaviour 
{
	
	public float amount = 10f;

    void Update()
	{
		float v = Input.GetAxis("Vertical")*amount*Time.deltaTime;
		float h = Input.GetAxis("Horizontal")*amount*Time.deltaTime;
	
		rigidbody.AddTorque(transform.right*v);
		rigidbody.AddTorque(transform.forward*h);
		
	}
}

This is my script for applying torque to a cube.
when I run this and press a key it does nothing but show me this message:

“transform.position assign attempt for ‘Cube’ is not valid. Input position is { NaN, NaN, NaN }.”

This is my second question, thanks for all the answers I have received but none have worked yet.

This seems to work for me.

using UnityEngine;
using System.Collections;
 
public class Control: MonoBehaviour 
{
    public float amount = 10f;
	private float v, h;
 
	void Start()
	{
		if(rigidbody == null)
		{
			gameObject.AddComponent<Rigidbody>();
			rigidbody.useGravity = false;
		}
	}
	
	void Update()
	{	
		v = Input.GetAxis("Vertical")*amount*Time.deltaTime;
		h = Input.GetAxis("Horizontal")*amount*Time.deltaTime;
	}
	
    void FixedUpdate()
    {
       rigidbody.AddTorque(transform.right*v);
       rigidbody.AddTorque(transform.forward*h); 
    }
}

On a side note, it’s good to handle Physics stuff inside FixedUpdate if you can.

GetComponent().AddTorque(transform.forward* h, ForceMode.VelocityChange);
GetComponent().AddTorque(transform.right* v, ForceMode.VelocityChange);

Add force mode and make sure your angularDrag is zero.