Why do I get UFUNCTION() Unrecognized types?

Hey,

I’m getting unrecognized type ‘CustomUserType’ when I add something like this to one of my actors:

UFUNCTION()
void SomeEventName(CustomUserType* someVariable);

Some types do work though, for example if we used FRotator instead of CustomUserType* then everything is fine.

What do I need to do here?

Thanks

Your class been not registered by UHT and when UHT reach this point it does not know how to generate things for your class, something is missing in your class… and i don’t know exactly what :stuck_out_tongue: but i can give you hints

  • First of all, all classes and structs beyond UObject class tree
    should have “F” prefix by UE4
    convention, UHT may require that
  • You could try adding UCLASS() before your FCustomUserType class
    declaration , #include
    “CustomUserType.generated.h” and
    GENERATED_UCLASS_BODY() inside class
    in it’s header file
  • Structs works for sure, so if you got vables only class, make it struct
    instead… you can actually try to
    add functions to struct too, but they
    mos likely won’t work with Blueprint.
    But remember same as classes it need
    USTRUCT(), GENERATED_USTRUCT_BODY(),
    generated header file include and
    also need to have “F” prefix in the
    name
  • In 4.3 there will be option in “Add Code to Project” which allows to
    create non-UObject classes which
    should supply class with everything
    you need.
  • Forgot to say, you dont really need
    to use UFUNCTION () as long as you
    dont want to use its features and you
    dont really need function to be seen
    by engine (like binding delegates to
    that funtion)