MacacaViewSystem
MacacaViewSystem copied to clipboard
cannot get references in OverrideButtonEvent function
Hi, I have a function which will modify text of a TMP_Text on the scene. I want to print log on my TMP_Text after I press the button. Here is my code
[SerializeField]
TMP_Text logText;
[OverrideButtonEvent("Content/CustomEventButton")]
void CustomOverrideFunction(Component component )
{
var log = "trigger CustomOverrideFunction, this on click event is override via script";
logText.text = log;
Debug.Log(log);
}
The output would be exception since logText is null. Seems it cannot get any reference in same class in a function with OverrideButtonEvent.