© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
6 replies
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Can't figure out display error avalonia
C#CC# / help
2y ago
✅ Can't figure out two error messages - Avalonia
C#CC# / help
2y ago
✅ Can't figure out why I am getting this error?
C#CC# / help
2y ago
✅ Can't figure out json logic
C#CC# / help
2y ago