Hello, I am pretty new to unity. I am trying to write a script that makes text appear on the screen when a cube makes contact with another cube. The script does not set the text to active, and gives 3 yellow errors in the console.
Two of them say:
The referenced script (Unknown) on this Behaviour is missing!
and the other give warning CS0108
, saying the
PuzzleCube hides inherited member component.gameObject
The following is my script which is assigned to the cube the player pushes into the other cube:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class PuzzleCube : MonoBehaviour
{
public GameObject gameObject;
public TextMeshProUGUI puzzleText;
// Start is called before the first frame update
void Start()
{
gameObject = GameObject.Find("PuzzleButton");
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider collider)
{
if (gameObject.CompareTag("PuzzleButton"))
{
puzzleText.gameObject.SetActive(true);
}
}
}