-
Notifications
You must be signed in to change notification settings - Fork 22
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
Expose properties defined in C# script component classes to Blueprints #27
Comments
Hi enlight Do you have any good references about the compilation process inside the editor? (for example is UBT used to compile it? Can i call own tools as prebuild/postbuild?) I have a idea how to solve this, but i lack the knowledge how the compilation is done by UE4. Another question: Why did you use plain c++ for the Klawr.ClrHost.Native, wouldnt it be easier to use c++/CLI for the wrapper? |
Do you mean the native code compilation and reloading Epic does? Then no, I don't know much about it, and I'm not sure there are any docs on the topic. I seem to recall a pull request or two to make it easier for plugins to hook into the build process, but that was a long time ago now, and things make have change significantly since then. As for your last question,
There a couple of other considerations I can think of though, C++/CLI is ugly (IMHO), only Visual Studio supports it (AFAIK), but only as a second class citizen. I also didn't want Klawr to be forever limited to the MS runtime, yes, right now the bootstrapping is done via COM which means that Klawr only works on Windows. However, I was hoping it would be possible to implement a Mono bootstrapper and build the wrappers with any C++/C# compiler on your platform of choice. This was before Microsoft decided to open source .NET, now I'm just hoping that in the future Microsoft or some enterprising hacker come up with a cross-platform CLR hosting interface to replace the COM one, and Mono finally becomes irrelevant. |
Thanks for the answers. Clarifies it a bit. I dont know, but i think it is quite hard (if not impossible) to create a COM interface dynamically at runtime, so i rely on one-time Reflection after c# compilation. |
I haven't actually thought of doing it that way before, but it sounds feasible if hot-reloading works reliably. The generated C++ classes would have to go into a separate plugin though, KlawrRuntimePlugin can't be reloaded after it bootstraps the CLR as the CLR itself can't be restarted within the same process. My original idea was to generate a
Yeah, COM is currently only used for bootstrapping and I'd prefer to keep it that way. |
A downside to my approach is, a simple As for the UKlawrBlueprintGeneratedClass.h, i seen it. And it can be a descendent of UKlawrBlueprintGeneratedClass. Doesnt matter if i define the interface to the c# class inside a UClass, AActor or whereever, just need a place for it. UKBPGC is a good place tho :) As for hot reload, i think it depends on the compiler class settings. Stumbled over a few constructors which mentioned EKismetCompileType::Cpp (in Blueprint.h for example) which is also passed in to the FBlueprintCompiler. KismetCompiler should take care or reloading the dll after compilation i think. Didnt find a place yet for file change detection/reporting to tell the editor it has to be rebuilt. |
This will work similarly to the C++ code, public properties marked by a yet to be implemented UPROPERTY attribute should be accessible via Blueprints.
The text was updated successfully, but these errors were encountered: