1

Alright so I'm learning unity right now and I opened my game this morning and ran into this error code

Assets\Standard Assets\Utility\SimpleActivatorMenu.cs(11,16): error CS0619: 
'GUIText' is obsolete: 'GUIText has been removed. Use UI.Text instead.' 

I have tried replacing GUIText with UI.Text however that lead to a different error messages of:

Assets\Standard Assets\Utility\SimpleActivatorMenu.cs(11,16): error CS0246:
The type or namespace name 'UI' could not be found (are you missing a using
directive or an assembly reference?)

or

Assets\Standard Assets\Utility\SimpleActivatorMenu.cs(11,16): error CS0246:
The type or namespace name 'UIText' could not be found (are you missing a using
directive or an assembly reference?)

Can anybody help me out here?

GabeV
  • 11
  • 1
  • 2
  • Did your using statements include UnityEngine.UI? – BugFinder Apr 24 '20 at 14:53
  • Does this answer your question? [GUIText is deprecated, so what should I use instead of it?](https://stackoverflow.com/questions/47447542/guitext-is-deprecated-so-what-should-i-use-instead-of-it) – Kale_Surfer_Dude Apr 24 '20 at 19:23

4 Answers4

1

You cannot simply replace GUIText with Text unfortunately. Check this answer out:

GUIText is deprecated, so what should I use instead of it?

Kale_Surfer_Dude
  • 884
  • 5
  • 10
1

you can just replace it using Text from UnityEngine.UI

Here's an example:

using UnityEngine.UI;

namespace YourNameSpace.Utility
{
    public class YourClass : MonoBehaviour
    {
        public Text myText;

        void Start()
        {
          myText.text = "Your text here";
        }

    }
}
Jovani
  • 11
  • 3
0

You should fallow these steps

  1. adding "using UnityEngine.UI;" begining of .cs file
  2. change all GUIText to Text.
Emre Gürses
  • 1,992
  • 1
  • 23
  • 28
0

Add this line :

using UnityEngine.UI;

and then replace :

GUIText with Text