This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.
If a user declares a UFunction with the exec specifier, the UHT will add a call to that function so that it can be used as a console command in the editor. This becomes an issue when the declaration of that UFunction is part of a #if WITH_EDITOR block. When building in Development, the declaration will be skipped by the compiler but the function will still be called in the .generated.h.
1. Create a new blank C++ project
2. Add a new C++ class through the editor (File > New C++ Class...) and add an Actor called MyActor
3. After Visual Studio appears, in the MyActor.h add the following code:
#if WITH_EDITOR
UFUNCTION(exec)
void TestFunction();
#endif
4. At the top of Visual Studio, use the drop down to change the build configuration from Development Editor to Development.
5. Compile (ctrl+shift+b)
Result: The compile fails with a message mentioning that the function isn't part of AMyActor.
Expected: The UHT should ignore the declaration in the #if WITH_EDITOR to avoid causing compilation errors
Head over to the existing Questions & Answers thread and let us know what's up.
1 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 4.8.3, 4.9 |
Created | Aug 19, 2015 |
---|---|
Resolved | Jan 17, 2017 |
Updated | Feb 5, 2017 |