Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
33
Question by Athullya · Jun 07, 2019 at 07:31 AM · guitexture

GUITexture adn GUIText are obsolete - Standard Assets,GUITexture and GUIText are obsolete

I downloaded Unity today and when I click on the play button I get these errors. How can I fix it? I saw a few similar problems online but nothing was applicable to this.

Assets\Standard Assets\Utility\ForcedReset.cs(6,27): error CS0619: 'GUITexture' is obsolete: 'GUITexture has been removed. Use UI.Image instead.'

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

Thank you,I downloaded Unity today and when I click on the play button I get these errors. How can I fix it? I saw a few similar problems online but nothing was applicable to this.

Assets\Standard Assets\Utility\ForcedReset.cs(6,27): error CS0619: 'GUITexture' is obsolete: 'GUITexture has been removed. Use UI.Image instead.'

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

Thank you

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ahmedaniss · May 01, 2021 at 04:41 AM 0
Share

Solved here : https://youtu.be/Ce8mZ1Dc6xw

6 Replies

· Add your reply
  • Sort: 
avatar image
68

Answer by ktduffyinc_unity · Jun 09, 2019 at 02:01 PM

@Athullya I WAS (this is an update I just fixed it!!) having the exact same problem. When I was opening up those files - SimpleActivatorMenu.cs and ForcedReset.cs, and making the suggested changes of GUITexture to UI.Texture and GUIText to UI.Text i was getting the following errors

  • Exception thrown while invoking [OnOpenAssetAttribute] method 'Unity.CodeEditor.CodeEditor:OnOpenAsset (int,int,int)' : InvalidOperationException: Cannot start process because a file name has not been provided.

  • InvalidOperationException: Cannot start process because a file name has not been provided.

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

  • Assets/Standard Assets/Utility/ForcedReset.cs(6,27): error CS0246: The type or namespace name 'UI' could not be found (are you missing a using directive or an assembly reference?)


  • then I found this post! - https://answers.unity.com/questions/1087908/the-type-or-namespace-ui-could-not-be-found-trying.html


-- so here is my solution

  • in both SimpleActivatorMenu.cs and ForcedReset.cs paste the following at the top "using UnityEngine.UI;"

  • where the originally suggested changes from GUITexture to UI.Texture and GUIText to UI.Text, I just removed the UI, as in the post link above!

now my game mode will play!!!

     //ForcedReset.cs
 
     using System;
     using UnityEngine;
     using UnityEngine.SceneManagement;
     using UnityStandardAssets.CrossPlatformInput;
     using UnityEngine.UI;
     //change GUITexture to Image
     [RequireComponent(typeof (Image))]
     
     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);
             }
         }
     }
 
 
 //////////////////////////////////
 //SimpleActivatorMenu.cs
 
 using System;
 using UnityEngine;
 using UnityEngine.UI;
 
 namespace UnityStandardAssets.Utility
 {
     public class SimpleActivatorMenu : MonoBehaviour
     {
 //// change GUIText to TEXT
         public Text 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[i].SetActive(i == nextactiveobject);
             }
 
             m_CurrentActiveObject = nextactiveobject;
             camSwitchButton.text = objects[m_CurrentActiveObject].name;
         }
     }
 }









Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image anshevil · Jun 21, 2019 at 07:01 AM 2
Share
 using UnityEngine.UI;
  GUIText to Text

avatar image deepan1999 · Jul 14, 2020 at 04:48 PM 0
Share

This problem seems to occur in the latest versions of unity above unity 2019, they changed the scripts! Thanks, $$anonymous$$uch Appreciated.

avatar image JetpackAwaaay · Sep 01, 2020 at 02:32 PM 0
Share

Other people take note: this is what a perfect technical forum answer looks like. Explain the the issue and explain exactly how to fix with clear examples. Thank you.

avatar image ahmedaniss · May 01, 2021 at 04:41 AM 0
Share

Solved here : https://youtu.be/Ce8mZ1Dc6xw

avatar image
32

Answer by GerardGrundy23 · Apr 10, 2020 at 07:45 AM

Search for SimpleActivatorMenu.cs

And change the code to this below.

I had this error today.

I added:

 using UnityEngine.UI;

and then changed:

public GUIText camSwitchButton;

to:

  public Text camSwitchButton;




Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
3

Answer by AngelaEngle12 · Feb 02, 2020 at 08:33 PM

@Athullya I had this same problem. I tried copying and pasting from the comment by @ktduffyinc_unity but it just threw me more warnings and the errors stayed. I just ended up deleting them. When I clicked "play", Unity re-downloaded those assets again and it works fine now.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image deadnancy · Jun 30, 2020 at 02:59 PM 0
Share

THANK YOU. I'll only add that I had to reload my project before I saw changes.

avatar image
2

Answer by Menatombo · Aug 15, 2020 at 02:43 PM

For users looking for the answer:

Add

 using UnityEngine.UI;
 using UnityEngine.UIElements;

to the the top of the script then change:

GUITexture to UI.Texture and GUIText to UI.Text

So, if you have something like:

 [RequireComponent(typeof (GUITexture))] 

change it to

 [RequireComponent(typeof(UnityEngine.UI.Image))]



Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by nanditho · Sep 16, 2020 at 10:52 AM

This really help.

So my question is how about these:

Image guiTex = gameObject.GetComponent();

         if (guiTex == null)
         {
             gameObject.transform.position = Vector3.zero;
             gameObject.transform.localScale = new Vector3(100, 100, 100);

             Image texture = gameObject.AddComponent<Image>();


             texture.enabled = false;
     
             texture.texture = new Texture2D(1, 1);
             texture.pixelInset = new Rect(0f, 0f, Screen.width, Screen.height);
             texture.color = Color.clear;
         }
     }

What should i change in order as solution to 1. GUITexture.pixelInset and 2. GUITexture.texture

Thanks

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ahmedaniss · May 01, 2021 at 04:42 AM 0
Share

Solved here : https://youtu.be/Ce8mZ1Dc6xw

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

148 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

GUITexture touch play animation 0 Answers

GUITexture is lagging my object 0 Answers

GUI.depth for use in same script or inherited script 2 Answers

The Screen Fader Script in the Stealth Project tutorial is not working in my game! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges