и theButton.GetComponent<Image>().eventAlphaThreshold = 1; не помогает
https://hostingkartinok.com/show-image. ... fd2fe00c1f
https://hostingkartinok.com/show-image. ... 145bb6f433
https://hostingkartinok.com/show-image. ... 0872858057
И все равно не срабатывает OnMouseDown ни лучом (лучом ловит только 3D модели а гуи игнорит). ОнКлик у кнопки срабатывает по всей прямоугольной области а нужно только чтоб срабатывал на полукруг.
Синтаксис:
Используется csharp
public Image theButton;
public float s = 0.5f;
void Start()
{
theButton.GetComponent<Image>().eventAlphaThreshold = 0.5f;
}
private void OnMouseDown()
{
print(111);
}
private void Update()
{
theButton.GetComponent<Image>().eventAlphaThreshold = s;
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = camera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit) && hit.transform != null)
{
Debug.Log("hit = " + hit.transform.name);
}
}
}
public float s = 0.5f;
void Start()
{
theButton.GetComponent<Image>().eventAlphaThreshold = 0.5f;
}
private void OnMouseDown()
{
print(111);
}
private void Update()
{
theButton.GetComponent<Image>().eventAlphaThreshold = s;
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = camera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit) && hit.transform != null)
{
Debug.Log("hit = " + hit.transform.name);
}
}
}
Что я сделал не так?