Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+14 votes

When I was going through the tutorial I noticed that when he made a script there was nothing in the script (besides the extended node) and yet on ours we get some already made functions. Is there a reason for the difference? I just deleted what popped up but now I'm wondering if I should have kept some of it...

asked in CSC380Jan2024 by (1 point)

9 Answers

+5 votes

I noticed that difference. However, I think deleting it should not change much. You can always create the deleted functions when you need them.

answered by (1 point)
+3 votes

Deleting the functions is okay. He has some setting turned on/off that make it so his script doesn't come with any functions. It's a difference of settings, so don't worry about it.

answered by (1 point)
+3 votes

The tutorial fella has the checkbox that adds default functions unchecked usually. The automatically added functions are just generally associated with those nodes in games, like physics functions with players. It doesn't do anything to remove them, just a nice feature that godot has to save some time.

answered by (1 point)
+3 votes

theres a template option that when selected adds certain functions depending on what node the script is attached to. Deleting those methods is fine you can just add them again later

answered by (1 point)
+3 votes

When creating the script, there is an option for template and when its checked it will create the _ready() function and the _process() function, they are ok to delete, or leave in. If you uncheck the template box, then the functions will not be created for you an dyou can create them at any time

answered by (1 point)
+3 votes

Yeah you can delete the functions that you don't need for your specific project. Godot generates them just to help you understand where to place your code for common tasks. If you find that you need a particular function later, you can always add it back too. Keeping the default functions can be helpful as they provide guidance on where to implement specific functionality.

answered by (1 point)
+3 votes

The reason the functions aren't created in his is because he had unchecked the "template" option which is prompted when you create a new script.

answered by (1 point)
+2 votes

When making the scripts, there are some options boxes that you can select and unselect. They have a template and built-in script. I'm pretty sure the template just has on_ready() and physics_process() . The built-in script automatically adds a physics process to physics objects.

answered by (1 point)
+2 votes

Sounds like you have the template option checked when you create a new script. If you forget to uncheck it just delete the functions.

answered by (1 point)
...