Search Unity

OnMouseUpAsButton never gets called

Discussion in 'Scripting' started by ViperCode_, Sep 3, 2011.

  1. ViperCode_

    ViperCode_

    Joined:
    Apr 11, 2011
    Posts:
    19
    Hi, i have a script for a 3D gui system and I am having issues with having OnMouseUpAsButton( http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnMouseUpAsButton.html )

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class highscore : MonoBehaviour {
    6.     public AudioClip button;
    7.     public GameObject text;
    8.  
    9.     void OnMouseEnter()
    10.     {
    11.         audio.PlayOneShot(button);
    12.         text.renderer.material.color = Color.red;
    13.     }
    14.  
    15.     void OnMouseExit()
    16.     {
    17.         text.renderer.material.color = Color.white;
    18.     }
    19.  
    20.     void OnMouseUpAsButton()
    21.     {
    22.         print("OnMouseUpAsButton");
    23.     }
    24.  
    25.     void OnMouseUp()
    26.     {
    27.         print("OnMouseUp");
    28.     }
    29. }
    30.  
    That is my my code.Everything but the OnMouseUpAsButton works.
    This refuses to work in javascript as well. Has anyone else encountered this issue?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It only works in Unity 3.4.

    --Eric
     
  3. ViperCode_

    ViperCode_

    Joined:
    Apr 11, 2011
    Posts:
    19
    oh... I should have tried that.. lol duh. thanks
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just FYI, the "History" link that's on all pages in the docs provides a list of which functions and so on were added to which version of Unity.

    --Eric
     
  5. ViperCode_

    ViperCode_

    Joined:
    Apr 11, 2011
    Posts:
    19
    Ah, ok thanks