Godot: Suggestion: default node script has _process(delta) already

Created on 10 Oct 2017  路  4Comments  路  Source: godotengine/godot

Hi,

Polish on Godot 3 is great so far. When I created a new script, however, I got this default:

extends Sprite3D

# class member variables go here, for example:
# var a = 2
# var b = "textvar"

func _ready():
    # Called every time the node is added to the scene.
    # Initialization here
    pass

I just think it would be nice if a new script contained along the lines of this instead (perhaps clearer):

extends Sprite3D

# Class member variables go here, for example:
# var a = 2
# var b = "textvar"

func _ready():
    # Called when this node is added to the scene.
        # Perform any initialization here:
    # self.set_process(true)
    pass

func _process(delta):
        # Called once on each frame if self.set_process(true) is used.
        # You could perform some game logic here:
    pass

This would have given me something to search for in the docs rather than kind of all the docs. It's also really similar to what Unity3D does, so might help with any transitioners ...

unity3d-template-1

discussion editor

Most helpful comment

I agree that _process() should be there by default. Opinions?
I can send a PR if there is agreement. :)

All 4 comments

I agree that _process() should be there by default. Opinions?
I can send a PR if there is agreement. :)

In 3.x, set_process(true) is called automatically when the _process() function is defined in a script, so this will cause useless overhead

You could leave it commented out in the template?

You could leave it commented out in the template?

I believe this is a good compromise. You can have it saying "uncomment this if you need to process every frame" or something.

Was this page helpful?
0 / 5 - 0 ratings