0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

初心者がUnity-Chanを設定して実行しようとしたらStandards Assetsでerror CS0619が出た

Posted at

使用バージョン

バージョンは以下を使用しています。

Unity, Package Ver
Unity 2021.3.12f1
Unity-Chan! Model 1.2.2
Standard Assets (for Unity 2018.4) 1.1.6

経緯

何か作ってみたい!と思い立ってUnityちゃんというのを動かしてみることに。
検索しつつ、UnityちゃんとStandard Assetsを用意して設定を行い実行!しかし…

実行時のエラー

実行したところ、下記のエラーが出る状態になっていました。

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

GUITextは削除されたからUI.text使ってねということらしい。
該当の場所を見ると、確かにGUITextとある。
初心者なので「ははぁ、UI.Textにすりゃいいのね」となってそのまま入力。エラー。なんで?
何故かはわからないので検索し、下記のサイトと文言を発見。

【Unity】Standard Assetsでエラーが出た時の対処方【error CS0619】

SimpleActivatorMenu.csファイルを開いて、「GUIText」を「Text」に変更します。

「UI.Text」じゃなかった…

記載されている通りに「Text」に変更し「using UnityEngine.UI」も追記したところで、無事実行が確認できました。

SimpleActivatorMenu.cs
using System;
using UnityEngine;
using UnityEngine.UI; //追加

#pragma warning disable 618
namespace UnityStandardAssets.Utility
{
    public class SimpleActivatorMenu : MonoBehaviour
    {
        // An incredibly simple menu which, when given references
        // to gameobjects in the scene
        public Text camSwitchButton; //GUITextをTextに変更
        public GameObject[] objects;
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?