Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | alwaysusa |
I have a static body parent scene that has a script with a single function in it, a sprite, and a collision poly 2D. All my prop objects inherit from that scene.
When trying to call a function from a body_entered signal on the player, the signal fires and finds the correct prop (I can print the correct name with body.name), but the has_method check fails to find the function in the parent script.
So I added a print statement to the ready function of the parent static body scene, and it doesn’t run. I have no idea why.
I tried using the _init() method, and that does run (and can call the custom function directly), but the _ready function does not run at all, and I cannot call the custom function from elsewhere. It’s as if the script doesn’t exist after init.
Am I missing something fundamental here? I feel like after a couple of years in Godot I might be losing my mind. Why on earth does the _ready method not run?
This seems to be a bug. The system works as expected, but something must have got corrupted using my method of creating the inherited scenes. When I create a NEW inherited scene using the same methods, it works fine. However, my existing inherited scenes (which all have the same setup) don’t work. Maybe because I duplicated them and changed the sprite and collision?
Either way, it’s a “remake the scene” solution. No idea how to reproduce.
alwaysusa | 2021-09-14 22:41