Error cs0619 guitext is obsolete guitext has been removed use ui text instead

Помогите решить проблему кто знает как. Ошибка CS0619, незнаю что делать. AssetsStandard AssetsUtilitySimpleActivatorMenu.cs(10,16): error CS0619: 'GUIText' is obsolete: 'GUIText has been remove...

Помогите решить проблему кто знает как. Ошибка CS0619, незнаю что делать.

AssetsStandard AssetsUtilitySimpleActivatorMenu.cs(10,16): error CS0619: 'GUIText' is obsolete: 'GUIText has been removed. Use UI.Text instead.'

введите сюда описание изображения

aepot's user avatar

aepot

42.3k5 золотых знаков17 серебряных знаков48 бронзовых знаков

задан 7 авг 2020 в 7:04

Sanchek19's user avatar

5

Написано же что устарела GUITexture и GUITex используйте UI.Image и UI.Image.Text

ответ дан 7 авг 2020 в 7:26

Aziz Umarov's user avatar

Aziz UmarovAziz Umarov

22.3k2 золотых знака9 серебряных знаков31 бронзовый знак

Сначала подключи UnityEngine.UI и замени где GUIText на Text

ответ дан 26 янв 2021 в 2:55

Daniel Petukhov's user avatar

Introduction

In this arti­cle we will see how to solve the error «GUI­Text is obso­lete» in Uni­ty, an error that start­ed to occur sev­er­al ver­sions ago because the GUI­Text pro­gram­ming class was replaced by anoth­er one and there are still many Uni­ty pack­ages using the pre­vi­ous version.

ABOUT THIS VIDEO

In this video we see how I solve this error that appears when import­ing the Stan­dard Assets pack­age. This is an error that is sim­ple to solve but it is impor­tant that you under­stand why it occurs and what to do, since the error can occur in count­less cas­es, you will have to iden­ti­fy how to do it in your par­tic­u­lar case.

HERE MY UNITY PLAYLIST
👇🏽

Steps to solve «GUIText is obsolete» in Unity

1. Open all the scripts that con­tain this error. Help your­self with the error infor­ma­tion in Unity’s con­sole (click­ing on the error will give you some extra infor­ma­tion), the con­sole will tell you the name of the script and the error line. If we dou­ble-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
Fig. 1: This is what the error «GUI­Text is obso­lete» looks like in the Uni­ty con­sole. Notice how the con­sole reports the script name, the error line and sug­gest how to solve it.

2. It is nec­es­sary to replace the use of the «GUI­Text» fields by the «UnityEngine.UI.Text» class. That is, where we see that «GUI­Text» is used (case sen­si­tive), delete it and write «UnityEngine.UI.Text» instead.

the GUIText error is obsolete in Unity because a script uses the GUIText class
Fig. 2: The GUI­Text com­po­nent is dep­re­cat­ed but in line 11 it is being used, result­ing in a con­sole error.
replacement of the GUIText component with the UI.Text component in Unity
Fig. 3: «GUI­Text» is replaced by «UnityEngine.UI.Text».

3. Save the script and ver­i­fy in the con­sole that the error disappears.

Option­al: The pre­fix «UnityEngine.UI» can be includ­ed in the script head­er, that way we can refer to the com­po­nent direct­ly as «Text». See lines 3 and 12 in fig­ure 4.

implementation of the UnityEngine.UI namespace and replacement of the GUIText component with the Text component
Fig. 4: Imple­men­ta­tion of the «UnityEngine.UI» name­space and replace­ment of «GUI­Text» with «Text».

CHECK OUT THIS CRAZY EXPERIMENT

Содержание

  1. 【Unity】The way to fix error CS0619:’GUIText’ is obsolete:’GUIText has been removed. Use UI.Text instead.’
  2. Overview
  3. Environment
  4. Occurences
  5. The way to fix it
  6. AssetsStandard AssetsUtilitySimpleActivatorMenu.cs(11,16): error CS0246: The type or namespace name ‘UI’ could not be found (are you missing a using directive or an assembly reference?)

【Unity】The way to fix error CS0619:’GUIText’ is obsolete:’GUIText has been removed. Use UI.Text instead.’

Table of Contents

Overview

There occured error CS0619:’GUIText’ is obsolete:’GUIText has been removed. Use UI.Text instead.’ to use Standard Assets. This article shows a way to fix it.

Environment

Occurences

Making C# script from Assets > Create > C# Script .

Attaching the script to Sphere object by drag & drop, I get message ‘Can’t add script’ .

This massage warns that the name of the script is different from its class name or there are some error of compiling. But I don’t find any error for compiling or the difference of the names.

Now, finding these GUIText error in console tab.

The way to fix it

Double-clicking the error in the console tab then the script “SimpleActivatiorMenu.cs” is opended.

Change it like following.

Addition : using UnityEngine.UI;
Comment out : public GUIText camSwitchButton;
Addition : public Text camSwitchButton;

This is a sample code fixed.

After changing codes and save it, the script can be attached to the Sphere Objects.

Источник

AssetsStandard AssetsUtilitySimpleActivatorMenu.cs(11,16): error CS0246: The type or namespace name ‘UI’ could not be found (are you missing a using directive or an assembly reference?)

So I am getting t$$anonymous$$s error:

AssetsStandard AssetsUtilitySimpleActivatorMenu.cs(11,16): error CS0246: The type or namespace name ‘UI’ could not be found (are you missing a using directive or an assembly reference?)

When I googled it, I ended up referred to t$$anonymous$$s article:

w$$anonymous$$ch recommends adding:

to SimpleActivatorMenu.cs and ForcedReset.cs

It also links to t$$anonymous$$s article:

So I follow those steps, as listed there, and when I attempt to test run, the following error appears:

PlayerSettings Validation: Requested build target group (20) doesn’t exist; #define symbols for scripting won’t be added. UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String) UnityStandardAssets.CrossPlatformInput.Inspector.CrossPlatformInitialize:SetEnabled(String, Boolean, Boolean) (at Assets/Standard Assets/Editor/CrossPlatformInput/CrossPlatformInputInitialize.cs:127) UnityStandardAssets.CrossPlatformInput.Inspector.CrossPlatformInitialize:.cctor() (at Assets/Standard Assets/Editor/CrossPlatformInput/CrossPlatformInputInitialize.cs:22) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])

I should also note that t$$anonymous$$s happened after I upgraded to 2019.3.0f6 and imported the Standard Assets from the Unity Store.

Источник

using UnityEngine.UI; — как исправить ошибку?

Приветствую, что мне надо сделать что быч это исправить? AssetsFPS Kit 3.0ScriptsPlayerPlayerNetwork.cs(23,9): error CS0619: ‘GUIText’ is obsolete: ‘GUIText has been removed. Use UI.Text instead.’

Я понимаю что он устарел, но что сделать? Unity 2020

Последний раз редактировалось daniilkas123 28 дек 2019, 22:45, всего редактировалось 1 раз.

daniilkas123
UNец
 
Сообщения: 34
Зарегистрирован: 04 дек 2019, 01:21

Re: Как изменить/удалить GUITEXT

Сообщение 1max1 28 дек 2019, 22:27

что сделать?

Use UI.Text instead.

Аватара пользователя
1max1
Адепт
 
Сообщения: 5285
Зарегистрирован: 28 июн 2017, 10:51

Re: Как изменить/удалить GUITEXT

Сообщение daniilkas123 28 дек 2019, 22:32

1max1 писал(а):

что сделать?

Use UI.Text instead.

AssetsFPS Kit 3.0ScriptsPlayerPlayerNetwork.cs(23,9): error CS0246: The type or namespace name ‘UI’ could not be found (are you missing a using directive or an assembly reference?)

using UnityEngine.UI; — добавлено, но все равно

Перевел так же все понял только одно что тип не найден, а хотя у меня есть это

Используется csharp

public UI.Text nameLabel;
        public UI.Text nameLabelShadow;

daniilkas123
UNец
 
Сообщения: 34
Зарегистрирован: 04 дек 2019, 01:21

Re: using UnityEngine.UI; — как исправить ошибку?

Сообщение 1max1 28 дек 2019, 23:47

Используется csharp

using UnityEngine.UI;
//
public Text nameLabel;

Или сразу:

Используется csharp

public UnityEngine.UI.Text nameLabel;

Аватара пользователя
1max1
Адепт
 
Сообщения: 5285
Зарегистрирован: 28 июн 2017, 10:51


Вернуться в Общие вопросы

Кто сейчас на конференции

Сейчас этот форум просматривают: GoGo.Ru [Bot], Yandex [Bot] и гости: 17



Всем доброго времени суток, столкнулся с ошибками компилятора, это обычное дело для стандартных ассетов юнити. Ошибки по SimpleActivatorMenu и Forced я исправил, но есть еще две ошибки, инфу про них в интернете найти не смог, так что надеюсь, что вы поможете. Вот ошибки:
AssetsStandard AssetsUtilityFPSCounter.cs(7,31): error CS0619: ‘GUIText’ is obsolete: ‘GUIText has been removed. Use UI.Text instead.’
AssetsStandard AssetsUtilityFPSCounter.cs(15,17): error CS0619: ‘GUIText’ is obsolete: ‘GUIText has been removed. Use UI.Text instead.’
Сам скрипт небольшой, если можете тыкните меня в место, которое нужно исправить)

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using UnityEngine;
using UnityEngine.UI;
 
namespace UnityStandardAssets.Utility
{
    [RequireComponent(typeof (GUIText))]
    public class FPSCounter : MonoBehaviour
    {
        const float fpsMeasurePeriod = 0.5f;
        private int m_FpsAccumulator = 0;
        private float m_FpsNextPeriod = 0;
        private int m_CurrentFps;
        const string display = "{0} FPS";
        private GUIText m_GuiText;
 
 
        private void Start()
        {
            m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod;
            m_GuiText = GetComponent<GUIText>();
        }
 
 
        private void Update()
        {
            // measure average frames per second
            m_FpsAccumulator++;
            if (Time.realtimeSinceStartup > m_FpsNextPeriod)
            {
                m_CurrentFps = (int) (m_FpsAccumulator/fpsMeasurePeriod);
                m_FpsAccumulator = 0;
                m_FpsNextPeriod += fpsMeasurePeriod;
                m_GuiText.text = string.Format(display, m_CurrentFps);
            }
        }
    }
}

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

Понравилась статья? Поделить с друзьями:
  • Error cs0579 повторяющийся атрибут system reflection assemblyversionattribute
  • Error cs0579 повторяющийся атрибут system reflection assemblycompanyattribute
  • Error cs0579 duplicate system reflection assemblycompanyattribute attribute
  • Error cs0579 duplicate global system runtime versioning targetframeworkattribute attribute
  • Error cs0535 unity