public static void SetCursor(Texture2D texture, Vector2 hotSpot) { if (texture != null) { instance.image.texture = texture; instance.rectTransform.sizeDelta = new Vector2(texture.width, texture.height); instance.rectTransform.pivot = new Vector2(hotSpot.x / texture.width, 1 - hotSpot.y / texture.height); instance.UpdatePosition(); instance.gameObject.SetActive(true); } else { instance.gameObject.SetActive(false); } }
private void Update() { cursor.UpdatePosition(); }