Acceleration in Character Scripts

I want my character to accelerate from one speed to another, but I have no idea how to.
I plan on having a minimum speed (speed) a maximum speed (maxSpeed) and an amount of time to accelerate to max speed (accelTime).

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Move3D : MonoBehaviour
{
public float speed;
public float jump;
protected bool newInput;
public CharacterController move;
public float maxSpeed;
public float accelTime;
private Vector3 moveDirection;
public float gravity;

void Start()
{
move = GetComponent();
}

void LateUpdate()
{
float yStore = moveDirection.y;
moveDirection = (transform.forward * Input.GetAxis(“Vertical”)) + (transform.right * Input.GetAxis(“Horizontal”));
moveDirection = moveDirection.normalized * speed;
moveDirection.y = yStore;

if (move.isGrounded)
{
moveDirection.y = 0f;
if (Input.GetButtonDown(“Jump”))
{
moveDirection.y = jump;
}
}

moveDirection.y = moveDirection.y + (Physics.gravity.y * gravity * Time.deltaTime);
move.Move(moveDirection * Time.deltaTime);

}
}

Any idea how I can insert it in here? Thanks.

Definitely start with some walk vs run tutorials. It’s super-simple stuff, so try one our two tutorials out and if you have questions, come back and post here.

When you post, if you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

How to understand errors in general: