Skip to main content
se añadieron 2 caracteres en el cuerpo
Origen Enlace
Israel-ICM
  • 3.6k
  • 25
  • 20
  • 26

queriaQuería ver que esta pasando con mi script, basicamentebásicamente lo que quiero es como en todos los fps shooters quiero mover la camarcámara con el mouse.

El error es:

Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }

queria ver que esta pasando con mi script, basicamente lo que quiero es como en todos los fps shooters quiero mover la camar con el mouse

El error es:

Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }

Quería ver que esta pasando con mi script, básicamente lo que quiero es como en todos los fps shooters quiero mover la cámara con el mouse.

El error es:

Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }
se añadieron 106 caracteres en el cuerpo; título editado
Origen Enlace
user128299
user128299

Hola, queria ver que esta pasando con mi script, basicamente lo que quiero es como en todos los fps shooters quiero mover la camar con el mouse A namespace cannot directly contain members such as fields or methods

queria ver que esta pasando con mi script, basicamente lo que quiero es como en todos los fps shooters quiero mover la camar con el mouse

El error es:

Sigo aca porque me quede sin espacio... el error es Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }

Hola, queria ver que esta pasando con mi script, basicamente lo que quiero es como en todos los fps shooters quiero mover la camar con el mouse

Sigo aca porque me quede sin espacio... el error es Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }

A namespace cannot directly contain members such as fields or methods

queria ver que esta pasando con mi script, basicamente lo que quiero es como en todos los fps shooters quiero mover la camar con el mouse

El error es:

Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }
Origen Enlace

Hola, queria ver que esta pasando con mi script, basicamente lo que quiero es como en todos los fps shooters quiero mover la camar con el mouse

Sigo aca porque me quede sin espacio... el error es Assets/camera.cs(17,10): erros CS0116: A namespace cannot directly contain members such as fields or methods

 public class Camera : MonoBehaviour
    {
        public Camera cam;
        public float mouseHorizontal = 3.0f;
        public float mouseVertical = 2.0f;
        public float minRotation = -65.0f;
        public float maxRotation = 60.0f;
        float h_mouse, v_mouse;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        h_mouse = mouseHorizontal * Input.GetAxis("Mouse X");
        v_mouse += mouseVertical * Input.GetAxis("Mouse Y");

        v_mouse = Mathf.Clamp(v_mouse, minRotation, maxRotation);
        cam.transform.localEulerAngels = new Vector3(-v_mouse, 0, 0);
    }