Skip to content

[FEATURE]: Ability to attach scripts to nodes #987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TheColorRed opened this issue Dec 21, 2024 · 4 comments
Closed

[FEATURE]: Ability to attach scripts to nodes #987

TheColorRed opened this issue Dec 21, 2024 · 4 comments
Labels
c: script-instance Script-instance APIs feature Adds functionality to the library

Comments

@TheColorRed
Copy link

I saw it in another gdextension library (J.E.N.O.V.A. for c++) that you can attach scripts to nodes instead of creating a whole new node, as it works just like you would attach a GDScript. This would be nice if that was supported.

image

@Bromeon
Copy link
Member

Bromeon commented Dec 21, 2024

This is partially supported through script instances, see godot::obj::script.

That said, it's not the primary workflow, and I personally won't be able to maintain scripting next to all the other priorities. In the past @TitanNano has helped a lot (and is the reason why so much exists at all right now 🙂). Would you be interested in working on these parts?

@TitanNano
Copy link
Contributor

There is also godot-rust-script that builds on gdext and allows for creating scripts in Rust.

@walksanatora
Copy link

walksanatora commented Dec 22, 2024

@TheColorRed you can add scripts to nodes. it just involves a whole process of making a ScriptLanguage, then you need to make a Script class for your language which creates ScriptInstances. an the Script also needs ResourceFormatSaver and ResourceFormatLoader (and if you mess up any of these classes the engine can and probally will crash. eg: The ResourceFormatLoader not detecting Script as a valid type so your script gets loaded as a TextFile and immedeatly casuing a nullref and crashing when it cast it to Script)

@Bromeon
Copy link
Member

Bromeon commented Dec 30, 2024

Closing since this is already possible, and there's godot-rust-script to streamline the process.

For godot-rust itself, I see the focus for now on improving the respective APIs so that users are unblocked in implementing the missing parts, and there's less than can be done wrong. But there's already #970 to track this.

@Bromeon Bromeon closed this as completed Dec 30, 2024
@Bromeon Bromeon added c: script-instance Script-instance APIs feature Adds functionality to the library labels Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: script-instance Script-instance APIs feature Adds functionality to the library
Projects
None yet
Development

No branches or pull requests

4 participants