Синтаксис:
Используется csharp
void Update ()
if(Physics.Raycast(gameObject.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition), out hitinfo))
{
//====не годится ===============================
if (EventSystem.current.IsPointerOverGameObject())
return;
//===============================================
if(Input.GetMouseButtonDown(0))
{
PointerEventData pointer = new PointerEventData(EventSystem.current);
pointer.position = Input.mousePosition;
List<RaycastResult> raycastResults = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointer, raycastResults);
if(raycastResults.Count > 0)
{
foreach(var go in raycastResults)
{
Debug.Log(go.gameObject.name,go.gameObject);
//====здесь нужно добавить блокировку прохождения луча если тыкнули по UI
}
}
if(hitinfo.collider.tag == groundTagName)
{
PickToMoove();
}
if (hitinfo.transform.tag == "Box") {
}
if(Physics.Raycast(gameObject.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition), out hitinfo))
{
//====не годится ===============================
if (EventSystem.current.IsPointerOverGameObject())
return;
//===============================================
if(Input.GetMouseButtonDown(0))
{
PointerEventData pointer = new PointerEventData(EventSystem.current);
pointer.position = Input.mousePosition;
List<RaycastResult> raycastResults = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointer, raycastResults);
if(raycastResults.Count > 0)
{
foreach(var go in raycastResults)
{
Debug.Log(go.gameObject.name,go.gameObject);
//====здесь нужно добавить блокировку прохождения луча если тыкнули по UI
}
}
if(hitinfo.collider.tag == groundTagName)
{
PickToMoove();
}
if (hitinfo.transform.tag == "Box") {
}