Topic was automatically imported from the old Question2Answer platform.
Asked By
Jhyatt
Old Version
Published before Godot 3 was released.
Hi everyone,
I’m having an issue with my project which is causing the _ready() function to be called twice from one of my scenes. I added a print call in the ready function to confirm that it is actually being called twice.
The output confirmed this.
I’ve searched within Godot as well as online but have not been able to find what is causing this to happen. Is anyone aware of a potential source of the issue?
Additional info that may be useful: I am using Godot Version 2.1.3 and the _ready() function is only being called twice in a single scene object, not all of them.
Thanks for any info!
And the scene that have _ready() func called twice doesn´t call any NOTIFICATION_READY, or emitting any signal that can execute something that derivate in the unwanted _ready()? (I suppose that the scene that you have with 2 called _ready´s is not the scene that you don´t want to execute twice, there will be nonsense)
Unfortunately this issue is not remote fixable whitout the proyect, sorry. You have to follow the “spaggeti” (no offense) to find where the function is called twice. It does not look like a godot bug (it’s not almost certainly safe). Good luck with that.
But you should start by comment the code that call twice the wanted repeated _ready() and if this fix the issue, then you have the path to fix that.
807 | 2017-08-17 23:41
try commenting everything that is not the print statement(and the _ready()) aka the spawn_brick() line and check the results
rustyStriker | 2017-08-18 09:49
More information is needed, that node should be entering the tree twice to do that.
Maybe you have two instances of the same node somewhere too.
The error behind this may be not noticeable on Godot 3 (in case of being a single instance) because ready is called once per instance in that version.