0 votes

Hello,

I was wondering where the most appropriate place to attach the script is. If you have a player scene, and you import it into your level scene. Should you attach the script that controls the player in the level scene or should you attach the script in the player scene? Or does it matter?

in Engine by (12 points)

1 Answer

0 votes

Ideally, you should try to make your scenes as autonomous as possible. That is, they should be able to function independently of other scenes. With that architecture, you can test individual scenes without the complication added by other scenes.

So, to your question specifically, I'd say the player control script should go in the Player scene. Again, ideally, that should allow you to test your player independently.

That said, like lots of things in software development, that's a guideline, not a requirement. Just keep it in mind and stick to it when/where you can.

by (19,302 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.