Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Trying to display hunger in a text box 3D C#

Discussion in 'Getting Started' started by phantomunboxing, Mar 20, 2016.

  1. phantomunboxing

    phantomunboxing

    Joined:
    Nov 10, 2015
    Posts:
    43
    Last edited: Mar 20, 2016
  2. shaderop

    shaderop

    Joined:
    Nov 24, 2010
    Posts:
    942
    And what exactly is the issue that you're facing?
     
  3. phantomunboxing

    phantomunboxing

    Joined:
    Nov 10, 2015
    Posts:
    43
    Error line 7
     
  4. phantomunboxing

    phantomunboxing

    Joined:
    Nov 10, 2015
    Posts:
    43
    Error line 7
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You need to add "using UnityEngine.UI;" to the top of your script.

    It's unfortunate that Unity has recently added all these separate namespaces, making their API harder for newbies (and slightly more annoying for veterans) to use. But there it is.
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,464
    In monodevelop,
    if some line shows error (red underline/highlight), you can right click it and select Resolve / using ... (if its missing it)
    in visual studio its, mouseover the word, click show potential fixes

    monodev_resolve_error.png


    vs2015_show_fixes.png