Here i have 4 functions, but the problem lies in the last 2 with their parameters. Initially i passed ULevel reference as a parameter, then decided to switch to UWorld soft object pointer, it didn’t quite work, same as FString
Don’t know if it’s weird to put interfaces into gamemode for this stuff, and i’m not sure if it’s the best practice for overriding interfaces but it worked perfectly so far in other classes
And here’s the live coding report. What’s weird is that it works perfectly if i switch it back to ULevel reference which led me to believe that the problem is in BP implementation, but at the same time i tried to delete the inherited BP and it still didn’t work.
Sorry if it’s a trivial question and thank you in advance
Try removing override; specifier, as these methods do not override anything.
If this does not work, give me whole .h and .cpp to try and replicate it here on my end.
Try removing override ; specifier, as these methods do not override anything.
If this does not work, give me whole .h and .cpp to try and replicate it here on my end.
OK so the TSoftObjectPtr cannot be used with UFUNCTION. If you want this to compile, then you must do it in C++ (or use solution in my next message bellow). Otherwise, just remove UFUNCTION line above both Load and Unload methods, and it should work for you. Try it out with TSoftObjectPtr<AActor> and you’ll get the same error result.
Also, you can do it like this, but this is no longer soft pointer, so I would avoid it. I still don’t get it why you would pass in the whole world. Why don’t you unlod and load by WorldName (FString)?
If you want to stick to TSoftObjectPtr and UFUNCTION, then you should use const TSoftObjectPtr<UWorld>& TargetLevel instead of TSoftObjectPtr<UWorld> TargetLevel
More generally, the BlueprintNativeEvent / BlueprintImplementableEvent specifiers make the generated code automatically convert any structure parameters to const& variants, causing this sort of error.
So this is also true for FString - change arguments to const FString& and it should work.
Wow, that’s a weird behavior. But it works now, so thank you.
In the end i opted to use FString as a parameter but the weird thing is that it still requires to be const address, which leads me to question how UHT determines interfaces, if you have any knowledge of this i would be happy to hear it
As for removing UFUNCTION macro i could only remove it in the derived class that implements the interface, NOT in the interface (that’s for anyone who’s looking for answers)
And yeah as for why i wanted to use UWorld i have a TMap of all levels that can load but didn’t think of simply using FString to find by key which is honestly my fault