Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

OnMouseEnter() Help Please.

Discussion in 'Scripting' started by Ncon123, Sep 9, 2015.

  1. Ncon123

    Ncon123

    Joined:
    May 6, 2015
    Posts:
    25
    Basicly I'm now getting used to the new UI, and I'm trying to use this function but nothing is happening, I have a box collider on the UI object and I've tested it with and with out on trigger selected please help I'm new to the new UI
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class SlotController : MonoBehaviour
    5. {
    6.  
    7.    
    8.     void Start ()
    9.     {
    10.    
    11.     }
    12.  
    13.     void Update ()
    14.     {
    15.    
    16.     }
    17.  
    18.     void OnMouseEnter()
    19.     {
    20.         transform.parent.GetComponent<InventoryController> ().selectedSlot = this.transform;
    21.     }
    22.  
    23.     void OnMouseExit()
    24.     {
    25.         transform.parent.GetComponent<InventoryController> ().selectedSlot = null;
    26.     }
    27. }
    28.  
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    isn't that from the old legacy GUI system?
     
  3. Ncon123

    Ncon123

    Joined:
    May 6, 2015
    Posts:
    25
    I dont think so? not sure but any help?
     
  4. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
  5. Ncon123

    Ncon123

    Joined:
    May 6, 2015
    Posts:
    25