Recibo el mensaje "error CS1022: Tipo o definición de espacio de nombres, o final de archivo esperado" en Unity pero no en Visual Studio. Solo necesito que mi personaje se mueva horizontalmente. He buscado en algunos foros sobre este error y las causas comunes donde hay errores tipográficos, corchetes mal colocados y variables incorrectas.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public float Character_Controller_2D: MonoBehaviour,
{
private float playerInput;
private float speed = 0;
private Rigidbody2D rigidBody;
// Start is called before the first frame update
void Start()
{
rigidBody = GetComponent<Rigidbody2D> ();
speed = GetComponent<speed> ();
}
// Update is called once per frame
void Update()
{
Vector3 playerInput = new Vector3(Input.GetAxisRaw("Horizontial"), 0);
transform.position = transform.position + playerInput.normalized * speed * Time.deltaTime;
}
}
Solución del problema
Elimina la coma después de MonoBehaviour.
No hay comentarios:
Publicar un comentario