Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UFUNCTION() for getter defined in header

I have a getter function in my header MaximumTopSpinBall.h declared as such:

         UFUNCTION(BlueprintCallable, Category = "PlayerHealth")
         float GetPlayerHealth() { return fCurrentHealth; }

But it's throwing a compile error stating a semicolon is missing before the next declaration. When I add an extra semicolon to the end it compiles, but the function doesn't show up in the blueprint. (It doesn't show up even when I just type "player".) alt text

Product Version: Not Selected
more ▼

asked Jan 04 '15 at 10:09 PM in C++ Programming

avatar image

199 15 18 35

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I think the code you placed in header file is conflicting with generated code. UHT assumes that you decler functions in header files and keep the code in cpp files.

more ▼

answered Jan 04 '15 at 10:14 PM

avatar image

37.2k 936 172 1116

avatar image Slowmanrunning Jan 04 '15 at 10:19 PM

I've moved it to my .cpp file, and it does seem to be compiling, but I'm still not seeing the function appear in my blueprint. As a method of AMaximumTopSpinBall, shouldn't the function show up when I drag out that reference?

AMaximumTopSpinBall does inherit from APawn, so I don't think there's anything wrong with me casting it like this.

avatar image Shadowriver Jan 04 '15 at 10:26 PM

Do you see your function in Library under "Player Health" category?

avatar image Slowmanrunning Jan 04 '15 at 10:45 PM

You mean like right clicking and unchecking 'context sensitive' so it displays at the top: "All Possible Actions"? Because no, I'm not seeing it or the Player Health category in there.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Well, that took an annoyingly long amount of time to figure out.

Closing the project and reopening it caused the functions to show up. That's all, just a reboot and the functions showed up. Compiling the code, the blueprint, reopening the blueprint, or even making an entirely new blueprint failed to make it show up when I tried earlier. I think I'll submit a bug report after I finally make a bit of progress today.

alt text

more ▼

answered Jan 05 '15 at 04:13 AM

avatar image

199 15 18 35

avatar image 8-lines Apr 30 '15 at 04:03 AM

Entirely new to C++ and had this issue as well. You're fix was great though!

Shame that after all this time that hasn't been addressed. But oh well...

avatar image Matthew J Apr 30 '15 at 02:22 PM

Hi 8-lines,

I see that you're encountering an issue where functions don't appear to be usable in your Blueprints until you close the compiler and restart it. If this is correct, can you provide steps to reproduce this issue?

I created the same function used in the original poster's example with no issue. Also, please be sure that you're compiling in 'Development Editor' mode in the compiler you're using. Not using this could require the editor to not be using the 'Hot Reload' feature which allows for it to update with newly compiled code.

If I can reproduce the issue, I can place the bug into our system and we can have it fixed as soon as possible.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question