Make a line show where bullet will travel?

In my game, I’m shooting bullets, and these bullets have a steep drop. I was hoping to do some sort aiming line to show where your bullet will go. Like in this game: t n x (ridiculous tank battles) - Community Showcases - Unity Discussions (requires unity web player)

In that game, you just hold left click, and a line will appear showing you where your bullet will go. How did they do this, and how can I do this?

Taken from Projectile prediction line? - Unity Engine - Unity Discussions (code written by user gfoot)

void UpdateTrajectory(Vector3 initialPosition, Vector3 initialVelocity, Vector3 gravity)
{
    int numSteps = 20; // for example
    float timeDelta = 1.0f / initialVelocity.magnitude; // for example

    LineRenderer lineRenderer = GetComponent<LineRenderer>();
    lineRenderer.SetVertexCount(numSteps);

    Vector3 position = initialPosition;
    Vector3 velocity = initialVelocity;
    for (int i = 0; i < numSteps; ++i)
    {
        lineRenderer.SetPosition(i, position);

        position += velocity * timeDelta + 0.5f * gravity * timeDelta * timeDelta;
        velocity += gravity * timeDelta;
    }
}

Basically you simulate a shot and just check its position each simulated FixedUpdate. You have to approximate how Unity’s physics will affect the projectile.

If you need the prediction to be 100% accurate at all times I see no way to accomplish this other than not using Unity’s physics for the projectile but rather moving it with your own code where you handle all physics yourself (gravity, bounces, wind etc).