eastbayeff

Untitled

Oct 26th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using UnityEngine.UI;
  6.  
  7. public class swap : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
  8. {
  9.  
  10.     public Sprite image1;
  11.     public Sprite image2;
  12.  
  13.     public void OnPointerDown(PointerEventData eventData)
  14.     {
  15.         GetComponent<Button>().image.sprite = image1;
  16.     }
  17.  
  18.     public void OnPointerUp(PointerEventData eventData)
  19.     {
  20.         GetComponent<Button>().image.sprite = image2;
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment