Im getting a error : Cannot implicitly convert type ‘bool’ to ‘int’. Can someone fix my dumb script?
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Hotbar : MonoBehaviour {
public int selectedSlot = 1;
public Image[] slots;
public Image selector;
private Inventory playerInv;
private void Update() {
if (playerInv == null) {
playerInv = GameObject.FindWithTag ("Player").GetComponent<Inventory>();
return;
}
UpdateScrolling ();
UpdateSelector ();
UpdateItems ();
}
private void UpdateScrolling() {
selectedSlot = Input.GetMouseButton (1);
if (selectedSlot < 1) {
selectedSlot = 9;
}
if (selectedSlot > 9) {
selectedSlot = 1;
}
}
private void UpdateSelector() {
selector.rectTransform.localPosition = slots [selectedSlot - 1].rectTransform.localPosition;
}
private void UpdateItems() {
}
public bool IsMouseOverSlot(int slotIndex) {
RectTransform rt = slots [slotIndex].GetComponent<RectTransform> ();
if (Input.mousePosition.x > rt.position.x - rt.sizeDelta.x * 1.5f && Input.mousePosition.x < rt.position.x + rt.sizeDelta.x * 1.5f) {
if (Input.mousePosition.y > rt.position.y - rt.sizeDelta.y * 1.5f && Input.mousePosition.y < rt.position.y + rt.sizeDelta.y * 1.5f) {
return true;
}
}
return false;
}
}