Im trying to add gravity to my game C# 3D

Hello, i have been trying to add gravity to my plan game to that you could only fly if you went up a ramp or something. I have a raycast so that it check below it to see if there is ground and if there is no ground, then i want it to be able to add gravity. Here is my code

using UnityEngine;
using System.Collections;

public class Plane : MonoBehaviour {

	public float speed = 10.0f;
	public float maxSpeed = 100.0f;
	public float minSpeed = 25.0f;
	public float gravity = 100;
	Vector3 currentMovement;

	void Update () {

		DetectCollision ();

		transform.Rotate (Input.GetAxis("Vertical"), Input.GetAxis("Turn"), -Input.GetAxis("Horizontal"));

		speed -= transform.forward.y * 50.0f * Time.deltaTime;

		//transform.position += transform.forward * Time.deltaTime * speed;

		if (speed < minSpeed) {
			speed = minSpeed;

		if (speed > maxSpeed) {
			speed = maxSpeed;

	void OnGUI (){

		GUI.Label (new Rect (10, 10, 100, 20),  speed.ToString("F0"));

	void DetectCollision () {

		Vector3 dwn = transform.TransformDirection(Vector3.down);
		if (Physics.Raycast (transform.position, dwn, 10))
			print ("Floor");
			transform.position.y -= gravity * Time.deltaTime;
			//I also try this instead of the above line of code.
			transform.position -= -transform.up * gravity * Time.deltaTime;

The problem is with the last part of the code. WHen i test the game, no gravity is applied and the plane stays still. Also i do not want to use a rigidbody. Thanks

Your problem is that you add gravity directly to your position. Gravity is an acceleration, so you need to add it to a variable, that contains your velocity.
At the end you should add your velocity * Time.deltaTime to your position.

Try this:

transform.position -= new Vector3(0, - gravity * Time.deltaTime, 0);

AFAIK you cannot change an attribute of a position vector, you have to set a vector.
Or do this:

var pos = transform.position;
pos.y -= gravity * Time.deltaTime;
transform.position = pos;