Я прикрепил скрипт к порядку компонентов камеры Vuforia AR, чтобы добавить кнопки к поверхности камеры Ar.
void OnGUI()
{
if (showComponent)
{
bool isOverlayClicked;
int onePartHeight = Screen.width / 10;
GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height)); // x,y,w,h
GUI.backgroundColor = Color.clear;
isOverlayClicked= GUI.Button(new Rect(0, 0, Screen.width, (Screen.height / 2) + 100 + (onePartHeight * 2)), "");
GUI.DrawTexture(new Rect(0, 0, Screen.width, (Screen.height / 2) + 100 + (onePartHeight * 2)), btntexture);
thisMenu.blocksRaycasts = thisMenu.interactable = false;//disallows clicks
thisMenu.alpha = 0; //makes menu invisible
if (isOverlayClicked)
{
Debug.Log("Overlay clicked in unity");
}
GUILayout.EndArea();
bool isProfileButtonClicked;
GUILayout.BeginArea(new Rect((Screen.width) - (iconSize + (25 * DPinPixels)), iconSize - (30 * DPinPixels), iconSize, iconSize));
GUI.backgroundColor = Color.clear;
isProfileButtonClicked = GUI.Button(new Rect(0, 0, iconSize, iconSize), "");
GUI.DrawTexture(new Rect(0, 0, iconSize, iconSize), profileViewTexture);
if (isProfileButtonClicked)
{
Debug.Log("Profile icon clicked in unity");
openProfileActivity();
}
GUILayout.EndArea();
}
}
При каждом щелчке по изображению профиля всегда вызывается щелчок по оверлейному изображению.
К вашему сведению: Наложение изображения занимает весь экран.
Я прилагаю скриншот моего приложения здесь.Любая помощь будет принята с благодарностью. ![enter image description here](https://i.stack.imgur.com/eiRMx.png)