Skip to main content
2 of 6
deleted 8 characters in body
CheckerT
  • 176
  • 10

Buttons in a scroll view not working Unity

I have created a scroll view in Unity, and wanted to make the elements inside clickable. It would function as a level select menu. The level panels are instantiated from a prefab.

As a first approach I added an IPointerClickHandler to the parent object (the background of the prefab, in gery)

the level prefab

using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;

public class ScrollViewItem : MonoBehaviour, IPointerClickHandler
{
    public TextMeshProUGUI title, length;

    public void initialize(string titleInit, float lengthInit)
    {
        title.text = titleInit;
        length.text = "Length: " + lengthInit.ToString("F0") + "s";
    }

    public void OnPointerClick(PointerEventData eventData)
    {
        Debug.Log("hello");
    }
}

it worked fine until yesterday, and today my unity editor crashed because of cpu issues i assume, and now this does not work anymore. For some reason the IPointerClickHandler does not react at all, and also if I add a Button to the prefab, the button stops working as well.

CheckerT
  • 176
  • 10