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

ba.animate giving error #57

Closed
rahulraman0108 opened this issue Jun 16, 2020 · 3 comments
Closed

ba.animate giving error #57

rahulraman0108 opened this issue Jun 16, 2020 · 3 comments

Comments

@rahulraman0108
Copy link

The ba.animate gives RuntimeError when trying to animate the text node's scale property inside handlemessage function.

image

image

@rahulraman0108
Copy link
Author

Update
Fixed the error by creating a 1ms delay timed call and it works.
However, I yet want to know what was the reason it did not work that way and why did this happen.
The updated code I used is in the image below:

image

@efroemling
Copy link
Owner

efroemling commented Jun 18, 2020

This is a new error check that I added recently; 1.4 used to allow such code to run although it was technically unsafe. Basically what is happening is that certain callbacks such as ba.DroppedMessage run in the middle of the scene simulation step, and at that time it is unsafe to create or destroy nodes or it can lead to crashes. And ba.animate() creates and modifies nodes which is why you hit the error.

Using a timer like you have done or simply using ba.pushcall() to defer the animate() until the next loop cycle is the correct workaround here. 👍🏻

In the future I will probably change those callbacks to happen after the simulation step so that such workarounds are unnecessary, but I didn't want to do that now just in case it subtly breaks any game logic. (Don't want to delay 1.5 any more than I already have)

@efroemling
Copy link
Owner

I'll go ahead and close this. Let me know if you have any more questions about this...

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

2 participants