Answers for "unity mouse click position"

C#
1

unity c# mouse click

// Detect if mouse is over an object
void OnMouseOver()
{
	// do something
  
	// Detect left mouse button click
	if(Input.GetMouseButtonDown(0))
	{
    	// do something
	}
}
Posted by: Guest on June-13-2021
1

unity mouse click position

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

RaycastHit hit = new RaycastHit();

if (Physics.Raycast(ray, out hit))
{
	return hit.point;
}
Posted by: Guest on May-02-2020

Code answers related to "unity mouse click position"

C# Answers by Framework

Browse Popular Code Answers by Language