I tried a script for moving the camera strictly with the arrow keys(NOT wasd) and it caused errors.

After looking this up and trying out some online scripts, I ran into a whole bunch of errors and I want to ask the community if I’ve missed something:

using UnityEngine;
using System.Collections;

public class KalusCamera : MonoBehaviour {
private float speed = 5.0f;
	// Use this for initialization
	void Start () {
	
	}

	void Update ()
	{
		if (Input.GetKey (KeyCode.RightArrow)) 
		{
			transform.Translate (Vector3 (speed * Time.deltaTime, 0, 0));
		}

		if (Input.GetKey (KeyCode.LeftArrow)) 
		{
			transform.Translate (Vector3(-speed * Time.deltaTime, 0, 0));
		}

		if (Input.GetKey (KeyCode.DownArrow)) 
		{
			transform.Translate (Vector3(0,-speed * Time.deltaTime, 0, 0));
		}
		if (Input.GetKey (KeyCode.UpArrow)) 
		{
			transform.Translate (Vector3(0,speed * Time.deltaTime, 0, 0));
		}

	}
}

What I’m ultimately aiming for is the camera to move with just the arrow keys as the player is controlled by the WASD keys. In the past I used the FPS prefab with the mouse look but now I want to change it so the player doesn’t need the mouse to move the camera.

Again this was the same script that I saw others share with other users who were struggling to make a game and from the looks of it, no one else had experienced these errors from them.

I’m using Unity 5 if it helps.

These are the errors I keep getting:

Here’s a good example of what I’m aiming for:

See how the camera still stays focused on the player even when the camera is moved around? That is what I’m aiming for. The player will be able to move the camera with the arrow keys and control the player with WASD.

You make repeated calls to a variable called “speed” but you never declared it. Add it to the top just under this class declaration:

public class KalusCamera : MonoBehaviour {
    private float speed = 5.0f;

Let me know if you have any other questions.