Search Unity

`Button' does not contain a definition for `onClick'?

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by virror, Oct 23, 2014.

  1. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Trying to use some example code i found here in the 4.6 section, but i keep getting two of these errors:
    Type `Button' does not contain a definition for `onClick' and no extension method `onClick' of type `Button' could be found (are you missing a using directive or an assembly reference?)

    Anyone can help me with this?
     
  2. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    525
    Do you have
    Code (csharp):
    1. using UnityEngine.UI; //or "import UnityEngine.UI;" for JS
    at the top of your script?
     
  3. ahn2150

    ahn2150

    Joined:
    Nov 5, 2010
    Posts:
    12
    in 4.6 Beta 20, OnClick() I'm not show that.....