C#C
C#3y ago
d4rkhydra

❔ 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
Was this page helpful?