- Home /
Question by
Geneon · Dec 31, 2014 at 11:25 AM ·
uieventsystem
UI Event System Question
Script:
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
public class _Slot : MonoBehaviour, ISelectHandler, IDeselectHandler, IPointerEnterHandler, IPointerExitHandler {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void OnSelect (BaseEventData eventData)
{
transform.FindChild ("Image").GetComponent <Image> ().color = new Color (255, 255, 255, 255);
}
public void OnDeselect (BaseEventData eventData)
{
transform.FindChild ("Image").GetComponent <Image> ().color = new Color (255, 255, 255, 50);
}
public void OnPointerEnter (PointerEventData eventData)
{
transform.FindChild ("Image").GetComponent <Image> ().color = new Color (255, 255, 255, 255);
}
public void OnPointerExit (PointerEventData eventData)
{
transform.FindChild ("Image").GetComponent <Image> ().color = new Color (255, 255, 255, 50);
}
}
The OnSelect and OnPointerEnter Change the Alpha Value fine.
The OnDeselect and OnPointerExit () Are called but do not change the image's Alpha value. Is there something I am doing wrong?
Comment
Your answer
Follow this Question
Related Questions
Implicit "Horizontal" Axis exceptions? 1 Answer
Is it wise to add scripts to Unity's Event System? 0 Answers
An issue related to button in world space canvas. 1 Answer
Event system or UI Button ? 0 Answers
MultiplayerEventSystem Same UI BUG 0 Answers