0 votes

It will be great to have Godot to have a nice PluginScript for C++ that essentially allows users to simply create a C++ script and attach it onto a node without the hassle.

asked Feb 23, 2018 in Engine by Joe0239 (188 points)

1 Answer

+1 vote

That's technically what NativeScript and C++ binding are already. The latter is not easy to use yet IMO, but you will never be able to write a Cpp file, attach it to a node and see it work instantly. This is is not the way C++ works (you must also have a very good reason to want C++ as a "scripting" language...).

I think it has been said already on multiple platforms (Github, Discord, and probably here on Q&A). In order for this to work, you have to compile C++ code into a library. For that you need a compiler toolchain (Visual Studio, GCC, MinGW...), which we cannot supply within Godot. Then you tell Godot where the library is, tell Godot which classes are inside and have a file representing each class so you can finally drag and drop to a node.
This workflow is already what NativeScript currently provides. I have no idea if using PluginScript for that would even be different.

This could happen automatically but it requires a lot of things to setup. And even if made automatic, it would have to deal with far more advanced situations than regular GDScripts, with libraries that have dependencies, build systems involved, compilation flags, developing on Windows, Mac, Linux etc.

In any case, I don't know if anything is planned, but nothing will happen until someone works on automating this (it doesn't have to be the main devs, it can be anyone knowing C++ enough, including you).

answered Feb 23, 2018 by Zylann (26,157 points)
edited Feb 23, 2018 by Zylann

That is what I mean, if it can automatically happen, that is what I mean by a plugin script that literally handles everything (converting cpp to dll) that sort of stuff (sorry for not understanding what plugin script is).

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 How to use this Q&A? before posting your first questions.