Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

check if mouse is in frame unity

// If you want to hide the mouse when it is in frame, use this:

var mouseLocation = Camera.current.ScreenToViewportPoint(Input.mousePosition);
        var outOfFrame = Mathf.Min(mouseLocation.x, mouseLocation.y) < 0 ||
                         Mathf.Max(mouseLocation.x, mouseLocation.y) > 1;
        UnityEngine.Cursor.visible = outOfFrame;

// If you want to prevent the mouse from leaving frame:

UnityEngine.Cursor.lockCursor = true;
Comment

PREVIOUS NEXT
Code Example
Csharp :: compare two strings in c# 
Csharp :: list sort c# 
Csharp :: c# dictionary with dictionary as value 
Csharp :: mysql: [Warning] Using a password on the command line interface can be insecure. 
Csharp :: Failed to generate swagger file. Error dotnet swagger tofile --serializeasv2 --output 
Csharp :: sum of digit of number c# 
Csharp :: c# inheritance 
Csharp :: c# get all letters 
Csharp :: how to add data in list in c# 
Csharp :: how to have referecne to script in unity 
Csharp :: how to create url parameters for URi C# 
Csharp :: new list/array with values c# 
Csharp :: calculator in c# 
Csharp :: freeze scene unity 
Csharp :: combine two arraylist c# 
Csharp :: c# only letters 
Csharp :: c# const 
Csharp :: how to write web service for API in c# 
Csharp :: c# calendar button random dates 
Csharp :: Get Component Trail rendere 
Csharp :: asp c# page scroll position change after postback 
Csharp :: how set format persian data picker to en 
Csharp :: top down view player movement 
Csharp :: c# remove xml invalid characters 
Csharp :: administration 
Csharp :: unity create a textbox in inspector 
Csharp :: Unity upload image to project 
Csharp :: check if object has parent unity 
Csharp :: Non-Serialized Fields in unity inspector 
Csharp :: generate random light colors programatically in android 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =