Interoperability with blueprints and data types #153
Replies: 2 comments
-
Supply myself an example that's not ideal: #150 - it's not ideal because the C# side knows too much about the game side. It's fine as a gameplay scripting system but a bit inconvenient if the C# side is pure-service (i.e. just generates generic data without knowing who will consume it). |
Beta Was this translation helpful? Give feedback.
-
This sort of limitations is known and this is something that I would like to solve for sure. Thanks for the input. |
Beta Was this translation helpful? Give feedback.
-
First, thanks for creating this plugin. Blueprint is all good but without a text-based scripting environment things are super in-efficient; C++ is fast but very hard to use with UE's large codebase and the syntax is not clean. Also, I just like C# a lot.
One issue I am finding here is there are currently only 2 blueprint functions to manage interfacing with C#, namely,
FindManagedFunction()
andExecuteManagedFunction()
- however, I do recognize we can count 2 more from the C# side: by usingActor.Invoke()
and Actor class's variousGet/SetXXX()
functions.Here is one particular scenario that I find quite basic yet inconvenient due to the lack of a simple data type
Vector
: How do you simply return a Vector3f (with 3 floating-point components) from a C# function? For instance, if I implement a C# function for finding the next enemy called "FindNextTarget()" (inside a class called "EnemyProvider") which takes no arguments and returns a single Vector3f that I wish to store on the caller Pawn actor - the current approach seems to REQUIRE my C# class to be aware of the type of the Caller and even be aware of the property names of the caller which makes it quite not self-contained for writing service-oriented codes.I guess there is however at least 1 simple workaround for this: allowing the provided UnrealCLR blueprint functions to have one more return value representing the State of the CLR runtime - specifically, it can just be the class instance/type reference for which the function was called, sort of like how LuaMachine implements its Blueprint functions (https://github.com/rdeioris/LuaMachine). Then it can provide a set of Get/Set functions that operate on the C# class instance directly within Blueprint environment: most importantly, please provide a
Set/GetVector()
besides basic data types.In the manual it's mentioned: "It's highly recommended to use creative approaches that extract information from blueprint classes instead of using plain strings for managed functions." - what are some examples?
Beta Was this translation helpful? Give feedback.
All reactions