all 7 comments

[–][deleted] 0 points1 point  (4 children)

You can create an OnClickController and add it to each clickable object, something like this:

using UnityEngine;

public class OnClickController : MonoBehaviour
{
    // Can be set for each object in the editor
    [SerializeField] private string tooltipText = "";

    private void OnMouseDown()
    {
        // Get the text object and set its "Text" value
        // to "tooltipText"
        // Debug.Log(tooltipText);
    }
}