Another bracket this “}” at the end at the end. I get more errors.
Assets/Script/Player.cs(5,14): error CS0101: The namespace ‘’ already contains a definition for ‘Player’
Assets/Script/Player.cs(10,10): error CS0111: Type ‘Player’ already defines a member called ‘Start’ with the same parameter types
Assets/Script/Player.cs(16,10): error CS0111: Type ‘Player’ already defines a member called ‘Update’ with the same parameter types
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float moveSpeed = 10;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
ControlsInput();
}
void ControlsInput()
{
if(Input.GetAxis("Vertical") > 0)
{
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
if(Input.GetAxis("Vertical") < 0)
{
transform.Translate(Vector3.back * moveSpeed * Time.deltaTime);
}
if(Input.GetAxis("Horizontal") > 0)
{
transform.Translate(Vector3.right * moveSpeed * Time.deltaTime);
}
if(Input.GetAxis("Horizontal") < 0)
{
transform.Translate(Vector3.left * moveSpeed * Time.deltaTime);
}
}
}
I know what it mean, but I couldn’t find another script name that. I was pretty confused, but I finally found it. It was in asset, but you can’t see it unless you clicked on the word asset even know you can see all the folder in asset without clicking on it. Thank you very much!!!