Unity Help With C# Scripting

Hi.

So I’m a new Unity student and my teacher knows literally nothing about the program. I’ve been following some tutorials to make a zombie game, but got bored and decided to go adventuring. None of the other students would have any idea since this is High School and half of them don’t even really want to be here. I had this idea to make a 2D game in a 3D environment and I only want my player character to move on the X and Y axes. I’ve tried a few different things, but keep coming up with errors and such. I was wondering how I could convert the code below to limit movement on the Z axis?

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour
{
CharacterController _controller;

	[SerializeField]
	float _moveSpeed = 5.0f;
	
	[SerializeField]
	float _jumpSpeed = 20.0f;
	
	[SerializeField]
	float _gravity = 1.0f;
	
	float _yVelocity = 0.0f;
	
void Start()
{
		_controller = GetComponent<CharacterController>();
}
	
void Update()
{
		Vector3 direction = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
		Vector3 velocity = direction * _moveSpeed;
		
		if (_controller.isGrounded)
		{
			if (Input.GetButtonDown ("Jump"))
			{
				_yVelocity = _jumpSpeed;
			}
		}
		else
		{
			_yVelocity -= _gravity;
		}
		
		velocity.y = _yVelocity;
		
		velocity = transform.TransformDirection(velocity);
		
		_controller.Move(velocity * Time.deltaTime);
}
}

Thanks,
Ben

 Vector3 direction = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

direction = (X, Y, Z)

y in this code is handled by the jump command later on, if you want to stop Z being used you don’t want to listen to any input there, you just want it to be 0.