Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity 2d raycast mouse

// detect object that was clicked using raycast

RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
 
if(hit.collider != null)
{
    Debug.Log ("Target name: " + hit.collider.name);
}
Comment

unity raycast 2d

Physics2D.Raycast(Vector2 origin, Vector2 direction, float distance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, float minDepth = -Mathf.Infinity, float maxDepth = Mathf.Infinity);
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# date format 
Csharp :: c# adding to a list 
Csharp :: c# calculator 
Csharp :: c# named parameters 
Csharp :: unity c# random number 
Csharp :: parse datetime c# 
Csharp :: get width of image unity 
Csharp :: c# change label from thread 
Csharp :: c# get list of all class fields 
Csharp :: c# run cmd hidden 
Csharp :: turn list of string to csv c# 
Csharp :: coroutine start unity 
Csharp :: database update dotnet 
Csharp :: unity instantiate prefab 
Csharp :: c# turn negative number into positive 
Csharp :: Task.FromResult(null) 
Csharp :: dns ttl meaning 
Csharp :: create new .net project 
Csharp :: raycasthit unity 
Csharp :: The entity type has multiple properties with the [Key] attribute. 
Csharp :: system linq c# 
Csharp :: how to deactivate an object unity 
Csharp :: get what week of the month c# 
Csharp :: how to get type of an object in c# 
Csharp :: c# char 
Csharp :: c# remove all punctuation from string 
Csharp :: how get data from json in c# 
Csharp :: dictionary to list c# 
Csharp :: how to locate a specific element in a list c# 
Csharp :: how to minimum text length in textbox in c# 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =