I was scripting when i found this error:error CS1519: Invalid token ‘=’ in class, struct, or interface member declaration
thise is the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class visuale : MonoBehaviour
{
public Transform player;
float sensibilità = 300f;
float rotazione;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
} Cursor.visible = false
// Update is called once per frame
void Update()
{
float x = Input.GetAxis(“Mouse X”) * Time.deltaTime * sensibilità;
float y = Input.GetAxis(“Mouse Y”) * Time.deltaTime * sensibilità;
rotazione -= y;
rotazione = Mathf.Clamp(rotazione, -60f, 60f);
transform.localRotation = Quaternion.Euler(rotazione, 0, 0);
player.Rotate(Vector3.up * x);
}
}
Please review the rules before creating another thread.
don’t create multiple threads
use descriptive titles
use code tags
don’t create low-effort posts. (example posting some code and asking for a fix).
There is a learn section on this site, I would recommend going through the tutorials and lessons there. You have posted a very common error, an error that describes what the problem is and what line it is on. This is VERY important, because you have a declaration outside of a method.
It actually isn’t illegal. Any UNICODE character is fine. “à” is fine in a variable name.
My understanding is C# is supposed to have full unicode support for identifiers. Though I have never tried, so can’t say for sure. Unity frequently has regressions around special characters, so I just don’t ever use them outside of the contents of a string.
I believe the real issue here is the “} Cursor.visible = false” line, where this code is just floating out in space without making any sense. But the OP didn’t provide the line number, so can’t say. @ already pointed this out though.
I have had to work with Unity (c#) code containing russian, chinese and korean characters on various project. Given I only speak 'Merican, it is a bit challenging debugging sometimes. But Unity and whatever ide you use will handle it.
(shaders are different story… grrrr)
Honestly, I don’t really care what supposed to be legal identifier officially. If someone comes here to ask for help and I need to identify what’s happening, I don’t want to google translate every single variable name so I maybe get some info out of it. It is this simple. I personally think using non-English identifiers in a project is plain dumb. You never know who needs to continue the work on your code next, especially if it isn’t a pet-project at home. But maybe I just worked too long in international teams…