C
C#16mo ago
DarkHydra

❔ An Error I can't figure out

using UnityEngine; using UnityEngine.UI; public class Ball_Controller : MonoBehaviour { private Rigidbody2D rb; public Text leaderboardLabel; public int score = 0; public GameObject ball; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody2D>(); rb.velocity = new Vector2 (3f, 3f); ball = GameObject.Find("Ball"); } private void OnCollisionEnter2D(Collision other) { if (other.gameObject.CompareTag("Paddle")) { score++; } } There's an error with the public text variable. It says that "the type or namespace "Text" could not be found" Although I have been following a tutorial
6 Replies
Kouhai
Kouhai16mo ago
When you fully qualify Text like this UnityEngine.UI.Text does it compile?
Denis
Denis16mo ago
$code
MODiX
MODiX16mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
TheBoxyBear
TheBoxyBear16mo ago
Shouldn't matter as the namespace is already defined in usings
Kouhai
Kouhai16mo ago
I didn't notice it actually omegalul
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server