커서를 단추로 가리키면 커서 아이콘을 변경해야하는 게임을 개발 중이며 단추를 가리 키지 않으면 정상 상태로 돌아갑니다. 지금까지 나는이 일을했지만 좋은 점이 전혀 없습니다. 내가 버튼에서이 스크립트를 부착하고 ...커서를 마우스로 가리킬 때 커서 아이콘 변경
using UnityEngine;
using System.Collections;
public class cursor : MonoBehaviour {
Vector2 mouse;
int w =32;
int h=32;
public Texture2D cursor1;
// Use this for initialization
void Start() {
Cursor.visible = true;
}
// Update is called once per frame
void Update() {
mouse = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
}
void OnMouseOver()
{
Cursor.SetCursor (cursor1, Vector2.zero, CursorMode.Auto);
}
void OnMouseExit()
{
Cursor.SetCursor (null,Vector2.zero,CursorMode.Auto);
}
}