- Home /
Normal Crosshair (crosshair IS the mouse)
I'm making a game on Unity 3D that requires a very specific crosshair. The crosshair needs to stay in the center of the screen at all times, the mouse can't be visible,and the crosshair needs to function like the mouse. I'm basicaly saying that I don't want a crosshair that is in the center of the screen but the mouse that moves when you look around is still what triggers things. The crosshair needs to be the crosshair, not an indicator of where the center of the screen is.
I want it for the purposes of dragging RigidBodies, gun aiming and pressing buttons. Something like the crosshair in Garry's Mod is what I want.
As far as I can tell, you're asking for a crosshair that's in the center of the screen at all times, but isn't in the center of the screen?
No, not at all. I want a crosshair that locks the mouse in the center of it while both the crosshair and mouse don't move from the center of the screen.
Answer by Ouss · Dec 06, 2014 at 08:56 PM
public Texture2D crossHair;
void OnGUI(){ //To make the crosshair always in the center of screen
GUI.DrawTexture(new Rect(Screen.width/2-crosshairTexture.width/2, Screen.height/2-crosshairTexture.height/2, crosshairTexture.width, crosshairTexture.height);
}
for the mouse thing you put mouselook script on the camera and then you hide the mouse: Screen.ShowCursor = false;