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

Error message for GUITexture

Discussion in 'Editor & General Support' started by dsantamonica, Feb 11, 2021.

  1. dsantamonica

    dsantamonica

    Joined:
    Jan 24, 2019
    Posts:
    22
    I upgraded to 2020.2 and got the attached error message that I don't know how to correct. Since I don't know Unity very well, help would be appreciated.
     
  2. KillDashNine

    KillDashNine

    Joined:
    Apr 19, 2020
    Posts:
    451
    As the errors state, GUITexture and GUIText have been removed and you should replace those with UI.Text and UI.Texture wherever they are used in your project. While you're at it, you could check TextMeshPro, it offers more formatting options and is simple to use.
     
  3. dsantamonica

    dsantamonica

    Joined:
    Jan 24, 2019
    Posts:
    22
    From what I can tell, A GUIText and Texture were old ways of writing text, which have now been removed. Unfortunately, I don't know which text it was or where it was removed, so I don't know how I would replace it.
    Would it have been part of something larger, or in a folder? Thanks for your help!
     
  4. KillDashNine

    KillDashNine

    Joined:
    Apr 19, 2020
    Posts:
    451
    Both are Components and you can find them in your scene by typing the name in the search box in your Hierarchy view. For each of those, remove the component, replace with Image and Text or whatever your choice. Then fix your scripts accordingly: you can find the script names in your error output.

    Actually in this case looks like these are being referred to by some scripts under Standard Assets/Utility, and these might be 3rd party libraries? In this case depends on these libraries; update them to a newer version or if they are discontinued then you are out of luck and they are incompatible with a newer Unity.
     
    Last edited: Feb 12, 2021
  5. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,657
  6. dsantamonica

    dsantamonica

    Joined:
    Jan 24, 2019
    Posts:
    22
    Thanks for helping me find ForcedReset.cs and SimpleActivatorMenu.cs.
    However, I’m not sure what to do with them.
    Deleting the ForcedReset.cs file made that error message go away.
    But deleting SimpleActivatorMenu.cs caused a lot more error messages to appear, so I put it back in the folder.


    Here’s the contents of SimpleActivatorMenu.cs:


    using System;
    using UnityEngine;

    namespace UnityStandardAssets.Utility
    {
    public class SimpleActivatorMenu : MonoBehaviour
    {
    // An incredibly simple menu which, when given references
    // to gameobjects in the scene
    public GUIText camSwitchButton;
    public GameObject[] objects;


    private int m_CurrentActiveObject;


    private void OnEnable()
    {
    // active object starts from first in array
    m_CurrentActiveObject = 0;
    camSwitchButton.text = objects[m_CurrentActiveObject].name;
    }

    public void NextCamera()
    {
    int nextactiveobject = m_CurrentActiveObject + 1 >= objects.Length ? 0 : m_CurrentActiveObject + 1;

    for (int i = 0; i < objects.Length; i++)
    {
    objects.SetActive(i == nextactiveobject);
    }

    m_CurrentActiveObject = nextactiveobject;
    camSwitchButton.text = objects[m_CurrentActiveObject].name;
    }
    }
    }
     
  7. dsantamonica

    dsantamonica

    Joined:
    Jan 24, 2019
    Posts:
    22
    Mauri, your answer didn't appear until I posted my response to JaakkOS , so I'll study what you had to say now.
     
  8. KillDashNine

    KillDashNine

    Joined:
    Apr 19, 2020
    Posts:
    451
    You need to know what those scripts are. If you delete them, I think your forced reset and activator menu functionalities will break. So your real goal is to replace those functionalities and at to do this in the way of replacing those outdated scripts.
     
  9. dsantamonica

    dsantamonica

    Joined:
    Jan 24, 2019
    Posts:
    22
    For the file SimpleActivatorMenu.cs, I learned from a video (
    ) that all I had to do is add “using UnityEngine.UI;” and change “GUIText” to “Text” in the file.


    Is there something as simple that I can do with ForcedReset.cs:


    using System;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    using UnityStandardAssets.CrossPlatformInput;

    [RequireComponent(typeof (GUITexture))]
    public class ForcedReset : MonoBehaviour
    {
    private void Update()
    {
    // if we have forced a reset ...
    if (CrossPlatformInputManager.GetButtonDown("ResetObject"))
    {
    //... reload the scene
    SceneManager.LoadScene(SceneManager.GetSceneAt(0).name);
    }
    }
    }
     
  10. dsantamonica

    dsantamonica

    Joined:
    Jan 24, 2019
    Posts:
    22
    I found another video by the same guy about the error message for GUITexture in ForcedReset.cs

    He said simply replace GUITexture with UnityEngine.UT.Image

    I did and the error went away, but new ones appeared complaining that my WebVRController has a problem because 'XRDevice.isPresent' is obsolete.

    Is that because I fixed the ForcedReset problem causing this problem?

    Two steps forward, one step backward!
     
  11. KillDashNine

    KillDashNine

    Joined:
    Apr 19, 2020
    Posts:
    451
    Look you can't just "click a button to switch to new Unity and everything will magically work". Why are you upgrading in the first place? Stay in the old version if you don't want to or don't know how to replace libraries that are declared obsolete in the new version. And I don't mean offense by this; I stayed in Ubuntu 14.04 when the latest was going somewhere in version 20.. and that's just cos I didn't want to change my ways and things were working perfectly where I was at that point. You shouldn't upgrade unless there's a reason for it, and if you have that reason, then you need to take all the hassle that comes with it.
     
    Last edited: Feb 13, 2021