How do I create Crosshair and getting object under Crosshair aka what player is aiming at.

How do I create crosshair and getting object under crosshair/mouse aka what player is aiming at. The title pretty much explains everything.

Thanks in advance. :)

Crosshair is a GUITexture and it depends on how the game is played If it's a FPS, then you could set the crosshair to the center of the screen. If the mouse determines the position, then set the GUI Texture to be at the mouse position and hide the mouse.

You could use Cursor.lockState:

void LockCursor(){
		Cursor.lockState = wantedcursormode;
		Cursor.visible = (CursorLockMode.Locked != wantedcursormode);
		if (Ispaused) {
			wantedcursormode = CursorLockMode.None;
		} else {
			wantedcursormode = CursorLockMode.Locked;
		}

This locks the Mouse in the Center of the screen and hiddes it at the same time :slight_smile: