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

Code error in Unity2D

Discussion in '2D' started by Damian323, Jan 5, 2016.

  1. Damian323

    Damian323

    Joined:
    Jan 5, 2016
    Posts:
    2
    So I've been having this problem with my code:
    Assets/Scripts/PlayerControl.cs(28,29): error CS1061: Type `UnityEngine.Texture' does not contain a definition for `text' and no extension method `text' of type `UnityEngine.Texture' could be found (are you missing a using directive or an assembly reference?)
    My code: fffffffff.PNG
    I'm not sure what's wrong with it PLEASE HELP! chef.PNG
     
  2. Tom01098

    Tom01098

    Joined:
    Jun 8, 2015
    Posts:
    42
    LivesUIText should be of type 'Text', not type 'Texture'.

    Change line 14 to that.
     
  3. Tom01098

    Tom01098

    Joined:
    Jun 8, 2015
    Posts:
    42
    Also, you should try and solve problems like this yourself, the error specifies that LivesUIText is a Texture
     
  4. Damian323

    Damian323

    Joined:
    Jan 5, 2016
    Posts:
    2
    Okay thank you I didn't notice that. :)