x

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"

Static Function in C++ Used in Blueprint

I've encountered weird circumstances lately. I've created a class in C++ and applied UCLASS macro on it. Inside this class, I created 5 static functions. All of these functions are UFUNCTION(BlueprintCallable, Category = "Helper"). I'm able to use them properly in Blueprint (event graph and macros). It runs fine when I play it in PIE.

But whenever I created the sixth static function in C++ and also use UFUNCTION(BlueprintCallable, Category = "Helper"), the Editor became unstable. Sometime it can appear normally like the other 5, in event graph and macro. But when I closed the UE editor and reload it, it show compilation error and the sixth function is undetected. I could easily close the UE editor, change the function name, rebuild the whole project in VS, and then reopen UE editor. It will then show this new function. I can use this function again normally. But it if I close the UE editor and reopen it, the same error keeps happening.

It seems like, the compiled static function in C++ is only available upon hot reload. But will be gone when the editor close. No matter how much I recompile or rebuild in VS, that function will be disregarded by UE editor. The only way to have UE editor recognize the sixth static function is by renaming it and recompile the source code. But it is only temporary upon hot reload. It'll be gone again, after the UE editor closes.

Here's an example of one of the static function (created in C++, but used in blueprint).

alt text

It is used to convert FColor structure to FLinearColor structure.

Is there some framework rule that I'm not aware of or is this a bug in UE editor?

Product Version: UE 4.12
Tags:
static function.jpg (122.9 kB)
more ▼

asked Sep 24 '16 at 06:34 AM in Bug Reports

avatar image

Pelangi
236 22 34 41

avatar image Shadowriver Sep 24 '16 at 02:05 PM

This looks like hot reload bugging out which is quite known problem, check if compiling while editor is closed makes things more stable.

avatar image Sean L ♦♦ STAFF Sep 26 '16 at 05:25 PM

Hey Pelangi,

I agree with Shadowriver that this does sound like a hot reload issue. Give his suggestion a try and let us know if that helps at all. If not, we can continue to investigate.

Thanks

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

1 answer: sort voted first

So I don't know the root cause and how to properly solve it. So I just created a fresh new project and then re-copy the source code + content files from the original project to this new one. I rebuild everything, made some adjustments to project settings (like the original one), and everything went well.

I can now add lots of static functions in C++ and use them in Blueprint without any problem. Thanks guys for your clarification.

more ▼

answered Sep 28 '16 at 03:16 PM

avatar image

Pelangi
236 22 34 41

(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