You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class MouseFollow : MonoBehaviour
{
// Start is called before the first frame update
public Image image;
public int ID;
public Button button, button;
void Start()
{
}
// Update is called once per frame
void Update()
{
image.transform.position = Input.mousePosition;
}
public void ChangeMouse(int id)
{
if (id == ID)
{
button.gameObject.SetActive(true);
button.gameObject.SetActive(false);
}
else
{
button.gameObject.SetActive(false);
button.gameObject.SetActive(true);
}
image.gameObject.SetActive(true);
image.sprite = EventSystem.current.currentSelectedGameObject.GetComponent<Image>().sprite;
}
public void ChangID(int id)
{
ID = id;
}
public void Changebutton(Button obj)
{
button = obj;
}
}