Game don't load by encapsulate a part of the code

pmmv999pmmv999 Posts: 2Member

Hi,

I have made a small change on my code and the program stop work, when running it stays infinity on the Godot loading screen, and not pass there. (I can see on Task Manager that it is using processor and infinity increase the RAM Usage)

I want to understand if i'm doing something wrong and why this happen

So the follow happens:

This code run:

This code don't run: (The print "start" isn't even show on console)

Thanks in advance!


Tags :

Comments

  • TheLiverManTheLiverMan Posts: 5Member

    I'm not sure I can offer too much help with the amount of code that is shown, but since you mentioned that the print("start") doesn't even show:

    Where is the startGame() method being called?

  • MegalomaniakMegalomaniak Posts: 2,898Admin
    edited September 4

    @pmmv999 said:
    (I can see on Task Manager that it is using processor and infinity increase the RAM Usage)

    The quoted part makes me think you might have run into a infinite loop causing a memory leak somewhere..?

    edit: also note that yield basically pauses the thread that is yielded so if you are running it in your main thread and have no return condition...

  • cyberealitycybereality Posts: 1,049Moderator

    I don't see exactly what is wrong, but the logic seems really strange. Maybe try to design around using signals and timers rather than using yield.

  • pmmv999pmmv999 Posts: 2Member
    edited September 4

    Hi everyone,

    @TheLiverMan yes, print("start") doesn't even show, basically the code even't run, startGame() is being call on the _ready()

    @Megalomaniak but it don't even run to there, don't know if still can have impact that way (Basically the game compile and don't run a single line of code)

    @cybereality will check that possibility thanks, kinda new with GDScript and the Yield was what i found to accomplish what i need.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file