Lerp / Vector Position float issue?

I have a cube that I’ve attached the following code to

using UnityEngine;
using System.Collections;

public class StartGame : MonoBehaviour {
	
	Vector3 oldPosition = new Vector3(5, 3, 0);
	Vector3 newPosition = new Vector3(50, 3, 0);

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnMouseDown(){
		var moveIT = GameObject.Find("Main Camera");
		moveIT.transform.position = Mathf.Lerp(oldPosition, newPosition, 10 * Time.deltaTime);
	   
		
		
	}
}

But I’m getting the following errors:

Assets/StartGame.cs(21,51): error CS1502: The best overloaded method match for `UnityEngine.Mathf.Lerp(float, float, float)’ has some invalid arguments

Assets/StartGame.cs(21,51): error CS1503: Argument #1' cannot convert UnityEngine.Vector3’ expression to type `float’

Sorry I’m new, and I’m a little lost.

Mathf.Lerp can only be used with floats (and i think integers) so basicaly numbers. What you’re trying to do here is using it with two Vector3 variables.

I think you’re searching for Vector3.Lerp instead of Mathf.Lerp.