-
-
Save naspapa/b0d231b32e24aa2268a5cdfecc361712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void rayGo() | |
{ | |
//Converting Mouse Pos to 2D (vector2) World Pos | |
Vector2 rayPos = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y); | |
RaycastHit2D hit = Physics2D.Raycast(rayPos, Vector2.zero, 0f); | |
if (hit) | |
{ | |
Debug.Log(hit.transform.name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment