Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

mouse position to canvas transform

Vector3 GetMousePosition() {
        Vector2 movePos;
        RectTransformUtility.ScreenPointToLocalPointInRectangle(
            parentCanvas.transform as RectTransform,
            Input.mousePosition, parentCanvas.worldCamera,
            out movePos);
        Vector3 positionToReturn = parentCanvas.transform.TransformPoint(movePos);
        positionToReturn.z = parentCanvas.transform.position.z - 0.01f;
        return positionToReturn;
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: PUN 2 Network Transform View Jittery Movement 
Csharp :: linq get values is not in other table 
Csharp :: c# extend array 
Csharp :: c# string size in bytes 
Csharp :: Rotate Object with keyboard 
Csharp :: C:UsersSherryDocumentssdata.dta 
Csharp :: how to change samesite=lax to samesite=none in asp.net 
Csharp :: unity roam, chase, attack states 
Csharp :: input string was not in a correct format convert to double 
Csharp :: f# set function how to ignore duplicates 
Csharp :: add buttons to taskbar thumbnail WPF 
Csharp :: Unity PlayOneShoot Audio 
Csharp :: auto refresh gridview c# 
Csharp :: c# printwindow chrome 
Csharp :: trigger checkbox combobox wpf 
Csharp :: params keycord as var name c# 
Csharp :: unity cone hit test spotlight lits object light on object test 
Csharp :: how to count specific controls in a container c# 
Csharp :: hacking 
Csharp :: netmath hack 
Csharp :: C# free text search 
Csharp :: unity raycast hit child object 
Csharp :: c# validate username and password 
Csharp :: belgium 251 PRG Prac 
Csharp :: c# operators 
Csharp :: listview android studio java 
Csharp :: convert memorystream to byte array c# 
Csharp :: c# use enum in class 
Csharp :: C# IEnumerable access element at index 
Csharp :: unity sword trail 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =