error CS1061: Type UnityEngine.GameObject' does not contain a definition for text’ and no extension method text' of type UnityEngine.GameObject’ could be found (are you missing a using directive or an assembly reference?)
When using Gameobject.find you cannot get Text?
trying to implement a score system for multiple players all seem stop work but I cannot assign text with game object.find?
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScoreControll : MonoBehaviour {
public int Player; // set when player joins a room.
public int Player1Score = 0;
public int Player2Score = 0;
public int Player3Score = 0;
public int Player4Score = 0;
public int Player5Score = 0;
public GameObject PlayersScore;
public GameObject PlayersScore1;
public GameObject PlayerScoreText1;
public GameObject PlayerScoreText2;
public GameObject PlayerScoreText3;
public GameObject PlayerScoreText4;
public GameObject PlayerScoreText5;
void LateUpdate () {
PlayersScore = GameObject.FindGameObjectWithTag ("PlaerScoreText");
PlayerScoreText1 = GameObject.FindGameObjectWithTag ("ScoreText1");
PlayerScoreText2 = GameObject.FindGameObjectWithTag ("ScoreText2");
PlayerScoreText3 = GameObject.FindGameObjectWithTag ("ScoreText3");
PlayerScoreText4 = GameObject.FindGameObjectWithTag ("ScoreText4");
PlayerScoreText1 = GameObject.FindGameObjectWithTag ("ScoreText5");
PlayerScoreText1.text = Player1Score.ToString();
PlayerScoreText2.text = Player2Score.ToString();
PlayerScoreText3.text = Player3Score.ToString();
PlayerScoreText4.text = Player4Score.ToString();
PlayerScoreText5.text = Player5Score.ToString();
// display our score
if (Player == 1) {
PlayersScore.text = Player1Score.ToString();
PlayersScore1.text = Player1Score.ToString();
}
if (Player == 2) {
PlayersScore.text = Player2Score.ToString();
PlayersScore1.text = Player2Score.ToString();
}
if (Player == 3) {
PlayersScore.text = Player3Score.ToString();
PlayersScore1.text = Player3Score.ToString();
}
if (Player == 4) {
PlayersScore.text = Player4Score.ToString();
PlayersScore1.text = Player4Score.ToString();
}
if (Player == 5) {
PlayersScore.text = Player5Score.ToString();
PlayersScore1.text = Player5Score.ToString();
}
}
}