hello im new to unity can anybody help me find an error in this because it is telling me error CS1002 script below

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerCam : MonoBehaviour
{
public float sensX;
public float sensY;

public Transform orientation()

float xRotation;
float yRotation;

private void start()
{
    Cursor.LockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

private void Update()
{
    // get mouse input
    float mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX;
    float mouseY = Input.GetAxisRaw("Mouse Y") * Time.deltaTime * sensY;

    yRotation += mouseX;

    xRotation -= mouseY;
    xRotation  = Mathf.Clamp(xRotation, -90f, 90f);

    // rotate cam and orientation
    transform.Rotation = Quaternion.Euler(xRotation, yRotation, 0);
    orientation.Rotation = Quaternion.Euler(0, yRotation, 0);
}

}

1 Answer

1

Hey and welcome,

as a general rule: if you ask something about an error: ** always highlight where** the error appears. This is important to be able to solve the issue. On top always share the actual error message, noone knows the error codes by heart.

luckily your code is short so the issue is that you wrote:

 public Transform orientation()

which would imply that a function body must follow or (which is more likely) that you inteded to write:

   public Transform orientation;