Search Unity

OnMouseEnter

Discussion in 'Scripting' started by imadrr, Dec 22, 2013.

  1. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
    Hi guys, i have a small problem : In the script reference "MonoBehaviour.OnMouseEnter" has to be attached to the gameobject, but i my script i create a texture like this :
    Code (csharp):
    1. GUI.DrawTexture(Rect(123, 14, hpBarLength, 30), HpBarTexture);  
    And i want to apply OnMouseEnter to the texture, so how i do it ?

    Thanks
     
  2. imadrr

    imadrr

    Joined:
    Dec 13, 2013
    Posts:
    20
  3. iWoundPwn

    iWoundPwn

    Joined:
    Feb 16, 2013
    Posts:
    212
    Don't know if I am of much help but you should try explaining the situation better also in C#
    Code (csharp):
    1. void OnMouseEnter()
    2. {
    3.     GUI.DrawTexture(Rect(123, 14, hpBarLength, 30), HpBarTexture);
    4. }
    or in Javascript?

    Code (csharp):
    1. function OnMouseEnter()
    2. {
    3.     GUI.DrawTexture(Rect(123, 14, hpBarLength, 30), HpBarTexture);
    4. }