enlight / klawr

A set of Unreal Engine 4 plugins that enable the use of C# (and other CLI languages) in game projects targeting the Windows platform.
MIT License
83 stars 22 forks source link

Generate specialized wrappers for UBlueprintFunctionLibrary subclasses #11

Open enlight opened 10 years ago

enlight commented 10 years ago

The current C# wrapper classes generated for Blueprint function libraries aren't terribly useful, the user should not need to explicitly acquire an instance of a UBlueprintFunctionLibrary in order to call the the functions it contains. For example, UKismetMathLibrary has a function called RandomBool, the user should be able to call this function in C# like so:

UMath.RandomBool();
enlight commented 9 years ago

AActor::GetWorld() is no longer exposed to Blueprints but many functions in Blueprint libraries expect a world context object to be passed in (from which they can obtain the relevant UWorld*), which makes it difficult to call such functions from managed code (well... actually not really, just need to pass any in any UObject that implements GetWorld() from the world you're interested in). Anyway, aside from exposing functions in Blueprint libraries as static methods rather than instance methods in managed code as described in my previous comment it is also worth considering making any function that requires a world context into an extension method for UObject. This would then be similar to how such Blueprint library functions are used in the Blueprint graph of a UObject (though they can only be used on UObject subclasses that actually implement GetWorld()).