Newbie at this, only had UE4 for a few days and trying to learn how to get it to interact with some C classes I already have. (not much of a C programmer either )
With blueprintcallable I have read the manual, and numerous posts but still just don;t get it. I think I must be missing something fundamental in my understanding.
Have completed the Helloworld tutorial and have now added a method I want to call from a blueprint, say when the user presses a key,
My latest version (there have been many versions) of helloworld.cpp looks like this
I just want getnum2 to appear in the blueprint editor, under category GAME, or anywhere really. Not sure if its conceptual, programming or blueprints so driving me nuts!
Your issue seems to be that you’re putting the UFUNCTION declaration outside the class header. CPP files are not processed by UnrealHeaderTool, and the compiler itself ignores things like UFUNCTION, so the only way for it to have an effect is for it to be placed in a .H file which is processed by the header tool (that is, in a Classes or Public directory). Put that UFUNCTION declaration in your header and everything should be fine.
While I have you, I’ll also point out that for classes which start with a U, A, F, or T prefix, it’s customary to also capitalize the following letter: AHelloworld. The header file should be similarly capitalized, and so should method names. It sounds pointless and pedantic, but I’ve definitely run into codegen-related problems when getting the capitalization wrong.