Using these codes below I got the mouse to stay in the center of the screen
These codes are Javer Script and there in yellow
Code 1:: function Update () {
Screen.lockCursor = true;
Screen.lockCursor = false;
}
Screen.lockCursor = true;
Screen.lockCursor = false;
}
Code 2:: Screen.showCursor = false;
Also to get the crosshair to show in the center of the screen I uead this code.
Crosshair Code:
Code 3: var crosshairTexture : Texture2D;
var position : Rect;
static var OriginalOn = true;
var position : Rect;
static var OriginalOn = true;
function Start()
{
position = Rect((Screen.width - crosshairTexture.width) / 2, (Screen.height -
crosshairTexture.height) /2, crosshairTexture.width, crosshairTexture.height);
}
{
position = Rect((Screen.width - crosshairTexture.width) / 2, (Screen.height -
crosshairTexture.height) /2, crosshairTexture.width, crosshairTexture.height);
}
function OnGUI()
{
if(OriginalOn == true)
{
GUI.DrawTexture(position, crosshairTexture);
}
}
{
if(OriginalOn == true)
{
GUI.DrawTexture(position, crosshairTexture);
}
}
Below is the crosshair that I made in Photoshop and then added to unity.
Using the simple reder settings (see Below) we added fog so we could hide the trees when they redered.
No comments:
Post a Comment