I am not sure if this should be in the Scripting forum but since it has a lot to do with the UI, I have posted it here instead.
Anyway what I am trying to do is have 2 scripts return an item when I mouse over an object.
First of all I have this:
using UnityEngine;
using System.Collections;
public class ItemControl : MonoBehaviour {
public void OnMouseOver(){
transform.parent.parent.GetComponent<Inventory>().selectedItem = this.transform;
}
void OnMouseExit(){
transform.parent.parent.GetComponent<Inventory>().selectedItem = null;
}
}
and then just a public transforms so I can see the item
using UnityEngine;
using System.Collections;
public class Inventory : MonoBehaviour {
public Transform selectedItem;
}
The problem: the scripts do not return the item. If anyone know how to fix this that would be awesome.