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

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,848
    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:
    8,998
    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