Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot get references in OverrideButtonEvent function #19

Open
NOVIO60229 opened this issue Sep 10, 2024 · 0 comments
Open

cannot get references in OverrideButtonEvent function #19

NOVIO60229 opened this issue Sep 10, 2024 · 0 comments

Comments

@NOVIO60229
Copy link
Contributor

NOVIO60229 commented Sep 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant