Skip to content

DissToast.Dismiss() before toast load error: NullReferenceException #3

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

Open
reahaas opened this issue Feb 16, 2024 · 2 comments
Open

Comments

@reahaas
Copy link
Contributor

reahaas commented Feb 16, 2024

In my function "Pause game" I have a call to "Toast.Dismiss();". This raises an error because the object is not initialized yet.
To fix this, just add a call to "prepare" before dismissing.
Error:

NullReferenceException: Object reference not set to an instance of an object
EasyUI.Toast.Toast.Dismiss () (at Assets/MyPackages/Toast UI/Scripts/Toast.cs:113)
GameManagerScript.pauseGame () (at Assets/Scripts/GameManagerScript.cs:126)
GameManagerScript.Update () (at Assets/Scripts/GameManagerScript.cs:95)
image
@reahaas
Copy link
Contributor Author

reahaas commented Feb 16, 2024

PR open: #4

@reahaas
Copy link
Contributor Author

reahaas commented Feb 16, 2024

Workaround:
Use the public attribute of the class: isLoaded

if (Toast.isLoaded){
    Toast.Dismiss();
}

herbou added a commit that referenced this issue Feb 17, 2024
Add Prepare call before Dismiss - Fix issue #3
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