Click here to Skip to main content
14,971,099 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class yes : MonoBehaviour
{

    public Text scoreText;

    // Update is called once per frame
    void Update()
    {
        scoreText.text = Text;
    }
}


What I have tried:

I tried asking my friend but he did the same script as me and it worked for him
Posted
Updated 19-May-21 1:25am

1 solution

Text is a type - otherwise this line would not compile:
public Text scoreText;

So this line:
scoreText.text = Text;
Tries to set a value but Text has not been declared as a variable anywhere in scope. Hence, the closest it can come is to find a class called Text and rightly complain about it.

I'm sure that isn't your whole code, and I'm sure you have some string you do want to assign - but we can't tell you what to type as we have no access to the rest of your code! (Or indeed, any idea what you are trying to do...)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900