Solving “GUIText is Obsolete” in Unity


In this article we will see how to solve the error “GUIText is obsolete” in Unity, an error that started to occur several versions ago because the GUIText programming class was replaced by another one and there are still many Unity packages using the previous version.

In the following video we see how I solve this error that appears when importing the Standard Assets package. This is an error that is simple to solve but it is important that you understand why it occurs and what to do, since the error can occur in countless cases, you will have to identify how to do it in your particular case.

Steps to solve “GUIText is obsolete” in Unity

1. Open all the scripts that contain this error. Help yourself with the error information in Unity’s console (clicking on the error will give you some extra information), the console will tell you the name of the script and the error line. If we double-click on the error, the script will open and the error line will be highlighted.

error GUIText is obsolete in unity console, double click to open script with error
Fig. 1: This is what the error “GUIText is obsolete” looks like in the Unity console. Notice how the console reports the script name, the error line and suggest how to solve it.

2. It is necessary to replace the use of the “GUIText” fields by the “UnityEngine.UI.Text” class. That is, where we see that “GUIText” is used (case sensitive), delete it and write “UnityEngine.UI.Text” instead.

the GUIText error is obsolete in Unity because a script uses the GUIText class
Fig. 2: The GUIText component is deprecated but in line 11 it is being used, resulting in a console error.
replacement of the GUIText component with the UI.Text component in Unity
Fig. 3: “GUIText” is replaced by “UnityEngine.UI.Text”.

3. Save the script and verify in the console that the error disappears.

Optional: The prefix “UnityEngine.UI” can be included in the script header, that way we can refer to the component directly as “Text”. See lines 3 and 12 in figure 4.

implementation of the UnityEngine.UI namespace and replacement of the GUIText component with the Text component
Fig. 4: Implementation of the “UnityEngine.UI” namespace and replacement of “GUIText” with “Text”.

Scroll to Top
Secured By miniOrange