前提
unityについての質問です
実現したいこと
得点表を表示したいです
発生している問題・エラーメッセージ
エラーメッセージ
NullReferenceException: Object reference not set to an instance of an object ScoreController.Start () (at Assets/ScoreController.cs:15) ### 該当のソースコード ```c# ソースコード
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScoreController : MonoBehaviour
{
int score = 0;
Text textComponent;
// Start is called before the first frame update void Start() { this.textComponent = GameObject.Find("Text").GetComponent<Text>(); this.textComponent.text = "Score " + score.ToString(); } // Update is called once per frame void Update() { } public void AddScore() { this.score += 10; this.textComponent.text = "Score " + score.ToString(); }
}
試したこと
コピペなのでスペルミスではないと思います
コンポーネントも確認したのですがアタッチされてました
補足情報(FW/ツールのバージョンなど)
unity 2021.3.11

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。