Developer Notes

Know limitation of UnrealHEaderTool. Everything inside of any #ifdef except WITH_EDITOR and WITH_EDITORONLY_DATA will be ignored by UHT.

Description

#ifdef and #ifndef have no affect when used in the header file of a class.

Ex:

#ifndef MYMACRO
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
		float ANumber;
#endif

ANumber variable does not show up in the editor when MYMACRO is not defined. Inverse also does not appear in editor (using #ifdef with macro defined)

Steps to Reproduce
  1. Open UE4 Editor
  2. Add code to project based on Actor (MyActor)
  3. In MyActor.h add the following:
    #ifndef RANDO
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
    		float ANumber;
    #endif
    
  4. Compile
  5. Create blueprint based on MyActor (MyActorBP)
  6. Add instance of MyActorBP to the level

Result:
ANumber does not appear in the details panel for the MyActorBP instance

Expected:
Since

Community References

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.11
Target Fix4.11
CreatedMar 17, 2016
ResolvedMar 18, 2016
UpdatedFeb 5, 2017