Ivan3z
(Ivan3z)
January 21, 2023, 3:56pm
1
I want to pass as argument of a function any type of structure.
I did some tests in C++ and the byte pointer works perfectly.
The problem is that apparently it is not allowed to use a byte pointer from blueprints.
I have not tried this yet but I think something like this could be the solution.
So the problem would be how to convert any structure to an FString from bluprints.
Any idea how to do it?
Thank you so much!!
Ivan3z
(Ivan3z)
January 22, 2023, 2:13am
2
Unfortunately doing this is a real headache.
It is much easier to work only with C++ and with concrete structures.
Anyway I found some interesting information.
I leave it here in case anyone is interested.
Thank you, this helped me a lot!
If anyone is interested, based on the example above I used the JsonObjectConverter to serialize any blueprint struct:
TSharedPtr<FJsonObject> AMyActor::BlueprintStructToJsonAttributes(FProperty* Property, const void* Value)
{
if (FStructProperty* StructProperty = CastField<FStructProperty>(Property))
{
TSharedPtr<FJsonObject> Out = MakeShared<FJsonObject>();
if (FJsonObjectConverter::UStructToJsonAttributes(StructProperty->Struct, Value, Out->Values))
{…
c
Ivan3z
(Ivan3z)
January 22, 2023, 9:23pm
3
This works!!
UFUNCTION(Blueprintcallable, Category = test)
void Test(USaveGame* saveGame, TSubclassOf< USaveGame> SaveGameClass);
It’s not a byte pointer but at least you can pass pointers to UObjects… that’s something!!