- Home /
Question by
RafiXWPT · Sep 17, 2015 at 06:33 PM ·
raycastui imagepanelinteraction
Cannot interact with image?
Hello, I am working on Expand Menu written by myself. I created couple of pannels and added some images which after click, expands menu with items. I added script ExpandMenu on Image UI Object but unfortunatelly, clicking that image or hovering it won't work and I don't know why. There is some screens:
Panel Look:
Panel Hierarchy:
On That Helmets image there is "Canvas Group" component with blocking raycast enabled. Also that image have "Layout Element" component.
Here is ExpandMenu script attached to that image:
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ExpandMenu : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler {
public void OnPointerEnter (PointerEventData eventData)
{
Debug.Log("EnterImage");
}
public void OnPointerExit (PointerEventData eventData)
{
Debug.Log("ExitImage");
}
void Start () {
}
public void OnPointerClick (PointerEventData eventData)
{
if(eventData.button.Equals(PointerEventData.InputButton.Left))
{
Debug.Log("ClickedImage");
}
}
}
That Text UI attached to "Helmets" object have canvas group with blocking raycast disabled.
Is there something I am doing wrong? Why That script won't react on mouse input?
panelhierarchy.png
(5.2 kB)
panellook.png
(18.9 kB)
Comment