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. Dismiss Notice

Cant add script component

Discussion in 'Scripting' started by alimrafeek, May 22, 2020.

  1. alimrafeek

    alimrafeek

    Joined:
    May 22, 2018
    Posts:
    14
    When trying to add a script to a gameobject an error box appears
    It says script class cannot be found.

    filename and class name are same and there is no other script with same name.
    I am trying to add axistouchbutton script from standard assets to a button
    What is the problem here?
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Do you have any compile errors in the console?
     
  3. alimrafeek

    alimrafeek

    Joined:
    May 22, 2018
    Posts:
    14
    Yeah,
    Assets\Standard Assets\Utility\SimpleActivatorMenu.cs(11,16): error CS0619: 'GUIText' is obsolete: 'GUIText has been removed. Use UI.Text instead.'
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,741
    Yep, there's your real problem. You need to use Unity's new UI system. The code you're trying to use has been obsolete for about a decade at this point (UnityUI came out about 2010), though this is the first I've heard that those classes have been actually removed from the engine instead of just deprecated. If you're following a tutorial or something, ditch it and find another - the tutorial you're following is hopelessly outdated. (There are UnityUI tutorials in Unity's Learn section)
     
    alimrafeek and PraetorBlue like this.
  5. alimrafeek

    alimrafeek

    Joined:
    May 22, 2018
    Posts:
    14
    Thanks Mate
     
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    From the scripting reference, it looks like it was removed with the release of 2019.3.