unity check when clicked on object
void Update()
{
// Check for mouse input
if (Input.GetMouseButton(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// Casts the ray and get the first game object hit
Physics.Raycast(ray, out hit);
Debug.Log("This hit at " + hit.point );
}
}
Also in C#:
- C# extend array
- reference to gameobject in different scene unity
- webclient c# example post
- c# param exception
- sticky footer bootstrap 3
- c sharp list of strings
- button color uwp c#
- bool toggle unity c#
- c# trim string
- c# how to use inovke
- regex replace all special characters
- constructor in inherited class c#
- convert string to boolean c#
- binding c#
- unity c# foreach
- c# null conditional
- how to insert into a list c#
- c# xml file builder
- unity html get request
- how to select time and date in datetimepicker in c#
- what is the or symbol in C#
- random from list c#
- c# get desktop path
- nunit return parameter