I’m trying to create a very simple helper class that I can use as a serializable/replicatable UPROPERTY in an actor class, but as soon as I add the UPROPERTY() attribute, I receive the error:
> error : In Town: Unrecognized type ‘FCapacity’
1>Error : Failed to generate code for MyGameEditor - error code: 4
Thanks for the response Rama (and for all of the Wiki contributions you’ve made btw, they’ve been greatly helpful),
I’d be happy to know how the FVector class can be made into a UPROPERTY, and how I can achieve similar results, I think.
From what I can tell, there isn’t much special going on in the class itself that makes this possible, but then, what external step would I need to do to expose my custom class in the same way?
I have been using structs in combination with blueprint library classes (defined in c++), as opposed to c++ classes to do this kind of thing. It’s irksome to stray from classes and methods, but I’m afraid I’ve found no better way to expose functionality and configurability to blueprint.
I actually found how to edit the u objects variables in the editor. You have to click the down arrow in the dropdow, then at the top is an Edit that will open up a new properties window containing all the UObjects variables defaults to edit.
Mark your FCapacity class as USTRUCT() with GENERATED_USTRUCT_BODY() macro inside (similar to how you would do it for UObject derived). Then you should be able to use it with UPROPERTY.
That is indeed the way I have been dealing with these scenarios (with ustructs in conjunction with blueprint function libraries), though this question was in regards to using classes (with methods) like we can use Structs.
Since this is not possible (as far as I now know), I will mark this as the correct response.