An Image has an inner -image within that is clickable.
Both the image an inner image should be clickable.
I use GUI.Button to show the images. Usually I create the inner image within a separated window. While in this situation is I can’t make the inner image within another window since I have to do it in a scroll view.
_ if(GUI.RepeatButton ( Rect( 120, topButton + 75, 40, 40), “”, script*.SkillIcon))*_ GUI.EndGroup(); in short : I want to able to click the panel and skill icon. but the skill icon is in the panel itself, while the panel is in a scroll view. Any ideas on solving this problem?
You can use a repeat button and render the second button within it with a pressed style, like so:
function OnGUI()
{
if (TextureToShow == null)
return;
var tLargeButton:Rect = Rect(0, 0, TextureToShow.width, TextureToShow.height);
var tSmallButton:Rect = Rect(0, 0, TextureToShow.width / 2, TextureToShow.height / 2);
if (GUI.RepeatButton(tLargeButton, TextureToShow))
{
// Put code for large or small button here (both will hit it)
if (tSmallButton.Contains(Event.current.mousePosition))
{
// Put code for only the small button here
var tPressedStyle:GUIStyle = GUIStyle(GUI.skin.button);
tPressedStyle.normal = tPressedStyle.active;
GUI.Button(tSmallButton, TextureToShow, tPressedStyle);
}
else
{
// Put code for only the large button here
GUI.Button(tSmallButton, TextureToShow);
}
}
else
GUI.Button(tSmallButton, TextureToShow);
}