Hi all,
Im having a problem making onMouseOver work. I am using a very simple code to test whether it is working.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class slotObjectsClass : MonoBehaviour {
static public bool hasPegAttached;
public GameObject slotObject;
static public bool isHighlighted;
static public Vector3 slotPosition;
static public GameObject pegObject;
static public float xDiff;
static public float zDiff;
static public bool overSlot;
// Use this for initialization
void Start () {
slotPosition = slotObject.transform.position;
}
// Update is called once per frame
void Update () {
pegObject = pegClass.pegsByColour[pegClass.pegsByColour.Length - 1];
xDiff = pegObject.transform.position.x - slotObject.transform.position.x;
zDiff = pegObject.transform.position.y - slotObject.transform.position.y;
Debug.Log(overSlot);
}
void OnMouseEnter () {
overSlot = true;
}
void OnMouseExit () {
overSlot = false;
}
//if xDiff < 0.12 and more than -0.12
//if zDiff < 0.12 and more than -0.12
}
so i'm expecting "true" to show at some point, however it does not. Bear in mind I have this script attached to 54 slots!!
The slots also all have box colliders on, which are not triggers and have not material set.
Any ideas?