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.’
@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?)
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*.SetActive(i == nextactiveobject);*
@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.