みかづきブログ その3

本ブログは更新を終了しました。通算140万ユーザーの方に観覧頂くことができました。長い間、ありがとうございました。

👆

引越し先はこちらです!

The type or namespace name `Text' could not be found. Are you missing `Unity Engine.UI' using derective?

Unityをはじめてみて最初にはまったことを忘れないようにメモしておきますが、

テキストを取得しようとして、

this.msgTxt.GetComponent<Text> ().text = "Ya-Ha-!";

みたいなコードを書いたら、

The type or namespace name `Text' could not be found. Are you missing `Unity Engine.UI' using derective?

というエラーがでて、

this.msgTxtが取得できてないのか?

とか、

GetComponentを使うんじゃないのか?

とか、

じゃないのか?

とか、いろいろ考えたんですが、原因はエラー文言を読んで字のごとく、

using UnityEngine.UI;

を忘れていただけでした。。。

エラー文言はちゃんと読もうと思いました。