Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

get object clicked unity 2d

RaycastHit2D hit = Physics2D.Raycast(Input.mousePosition, Vector2.zero);
if (hit.collider != null)
{
	Debug.Log("Clicked on Object!");
}
Comment

unity click on 2d object

// Requires for the object to have a collider and this script attached
private void OnMouseDown()
{
	Debug.Log("Clicked on object!");
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to create an array in c# 
Csharp :: unity hide in inspector 
Csharp :: how to stop rigidbody2d from falling in unity 
Csharp :: prettier inst working c# 
Csharp :: public GameObject 
Csharp :: despicable me 
Csharp :: c# unity follow object 
Csharp :: get normal from 3 points 
Csharp :: C# HttpClient POST request 
Csharp :: c# split text by spaces 
Csharp :: unity controls 3d 
Csharp :: cs entity framework 
Csharp :: fluentassertions force exceptions 
Csharp :: c# list remove duplicate items 
Csharp :: milliseconds to seconds c# 
Csharp :: if char is upper csharp 
Csharp :: unity check if a animator parameter trigger is activated 
Csharp :: print random number unity 
Csharp :: open folder dialog c# 
Csharp :: c# split on multiple characters 
Csharp :: c# write byte[] to stream 
Csharp :: c# list to string join 
Csharp :: jump in unity 
Csharp :: how to create a file through c# script 
Csharp :: 2d list in c# 
Csharp :: how to do time.deltatime in c# 
Csharp :: c# environment variables 
Csharp :: c# list with 0 initialize 
Csharp :: if in dictionary c# 
Csharp :: unity pick random number 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =