Introduction
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](https://gamedevtraum.com/wp-content/uploads/2020/10/error-guitext-is-obsolete-in-unity-min.png)
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](https://gamedevtraum.com/wp-content/uploads/2020/10/guitext-component-to-replace-in-unity-min.png)
![replacement of the GUIText component with the UI.Text component in Unity](https://gamedevtraum.com/wp-content/uploads/2020/10/replace-guitext-with-unity-engine-ui-text-unity-min.png)
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](https://gamedevtraum.com/wp-content/uploads/2020/10/implementing-unityengine-ui-unity-min.png)