hello!
this is my code:
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class MyClass : MonoBehaviour
{
[SerializeField] private int value1;
[SerializeField] private int value2;
[SerializeField] private int value3;
void MyFunction()
{
value1 = 10;
value2 = 20;
value3 = 30;
}
public void CallButtonClicked()
{
Debug.Log($"{value1} {value2} {value3}");
}
}
the event CallButtonClicked is selected in the OnClick
list of the button: choosing the gameobject where myclass is attached and choosing the function…
if I call MyFunction and the values take the 10, 20, 30, when I press the button, the values are 0…
I found a workaround using the listener by code… but is not a good stuff… any ideas?
thank you