how to gradually increase speed unity
using UnityEngine;
public class example : MonoBehaviour
{
public float acceleration = 5f; // how much you want object to accelerate
public float maxSpeed = 20f; // maximum speed the object can reach
private float curSpeed = 0f; // the Current speed of the object
void Update ()
{
Move();
curSpeed += acceleration * Time.deltaTime;
if (curSpeed > maxSpeed)
{
curSpeed = maxSpeed;
}
}
void Move()
{
transform.Translate = (Vector3.right * curSpeed); // gradually increases speed of object as it moves right
}