Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have written the program but is giving the following error:

Assets/Standard Assets/Utility/ForcedReset.cs(6,27): warning CS0618: UnityEngine.GUITexture' is obsolete: This component is part of the legacy UI system and will be removed in a future release.'

Please tell me how to solve this error.

What I have tried:

C#
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);
        }
    }
}
Posted
Updated 22-Feb-18 8:50am
v2

1 solution

Quote:
I have written the program but is giving the following error:

No, it is not an error, it is a warning.
Quote:
warning CS0618: UnityEngine.GUITexture' is obsolete: This component is part of the legacy UI system and will be removed in a future release.

The message warns you about a future problem. Even if I don't know or use this UnityEngine, I know where to find solution:
- Read documentation and you will get reason of warning and replacement.
A simple Google search with "UnityEngine.GUITexture obsolete" will lead you to useful informations and to solution.
 
Share this answer
 
v2
Comments
phil.o 22-Feb-18 14:59pm    
Down vote countered.
Patrice T 22-Feb-18 15:04pm    
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900