hi I’m a complete novice and I don’t know what identifier or where to put it
help is very appreciated
here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Curser
{
void Update()
{
Vector3 CursorPos = Camera.main.ScreenToWorldPoint;
ref Curser; Transform.position = new Vector3(CursorPos.x, CursorPos.z) (Input.mousePosition);
}
}
Line 10 seems like some kind of frankenstein of 3 different lines of code. Pick one thing you want to do, and delete the rest or put the rest on different lines.
Curser should be inherited from MonoBehaviour.
ref Curser, what’s that?
Transform is name of class, transform is field of MonoBehaviour.
What are the arguments of ScreenToWorldPoint method?
Also the Vector3 constructor is incorrect.
I guess you want to do something like that?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Curser : MonoBehaviour
{
void Update()
{
Camera currentCamera = Camera.main;
Vector3 cursorPosition = Input.mousePosition;
Vector3 worldPosition = currentCamera.ScreenToWorldPoint(cursorPosition);
worldPosition += currentCamera.transform.forward * 5;
transform.position = worldPosition ;
}
}
I highly recommend to learn C# basic syntax and fundamentals first. Unity and gamedev is cool, but you won’t go far struggling with syntax errors.