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"

Issue with variables named "None" within a struct

Greetings !

I found an issue that bothered me this morning:

-UHT will generate wrong property name for variables which are named "None" within a struct.


 struct FSTestStruct
     UPROPERTY(EditAnywhere, Category = Defaults)
         uint8 None;
     UPROPERTY(EditAnywhere, Category = Defaults)
         uint8 One;
     UPROPERTY(EditAnywhere, Category = Defaults)
         uint8 Two;

And I get the following compilation error:

 Error    1    error C2039: 'ByteProperty_0' : is not a member of 'FSTestStruct'    C:\Users\FrostSnake\Documents\Unreal Projects\WizardArena\Intermediate\Build\Win64\Inc\UProto\UProto.generated.cpp    435    1    WizardArena

and when I navigated to the error's line, I found this:

 UScriptStruct* Z_Construct_UScriptStruct_UMyStructs_FSTestStruct()
         UStruct* Outer=Z_Construct_UClass_UMyStructs();
         static UScriptStruct* ReturnStruct = NULL;
         if (!ReturnStruct)
             ReturnStruct = new(Outer, TEXT("STestStruct"), RF_Public|RF_Transient|RF_Native) UScriptStruct(FPostConstructInitializeProperties(), NULL, new UScriptStruct::TCppStructOps<FSTestStruct>, EStructFlags(0x00000001));
             UProperty* NewProp_Two = new(ReturnStruct, TEXT("Two"), RF_Public|RF_Transient|RF_Native) UByteProperty(CPP_PROPERTY_BASE(Two, FSTestStruct), 0x0000000000000001);
             UProperty* NewProp_One = new(ReturnStruct, TEXT("One"), RF_Public|RF_Transient|RF_Native) UByteProperty(CPP_PROPERTY_BASE(One, FSTestStruct), 0x0000000000000001);
             UProperty* NewProp_ByteProperty_0 = new(ReturnStruct, TEXT("ByteProperty_0"), RF_Public|RF_Transient|RF_Native) UByteProperty(CPP_PROPERTY_BASE(ByteProperty_0, FSTestStruct), 0x0000000000000001);
             UMetaData* MetaData = ReturnStruct->GetOutermost()->GetMetaData();
             MetaData->SetValue(ReturnStruct, TEXT("BlueprintType"), TEXT("true"));
             MetaData->SetValue(ReturnStruct, TEXT("ModuleRelativePath"), TEXT("MyStructs.h"));
             MetaData->SetValue(NewProp_Two, TEXT("Category"), TEXT("Defaults"));
             MetaData->SetValue(NewProp_Two, TEXT("ModuleRelativePath"), TEXT("MyStructs.h"));
             MetaData->SetValue(NewProp_One, TEXT("Category"), TEXT("Defaults"));
             MetaData->SetValue(NewProp_One, TEXT("ModuleRelativePath"), TEXT("MyStructs.h"));
             MetaData->SetValue(NewProp_ByteProperty_0, TEXT("Category"), TEXT("Defaults"));
             MetaData->SetValue(NewProp_ByteProperty_0, TEXT("ModuleRelativePath"), TEXT("MyStructs.h"));
         return ReturnStruct;

As you can see, the property's name ("None") was changed to ("ByteProperty_0").

Product Version: Not Selected
more ▼

asked Dec 03 '14 at 08:07 AM in Bug Reports

avatar image

62 7 11 14

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

1 answer: sort voted first

Hi there! The name "None" is a reserved word that is used symbolically across UE4 to represent an uninitialized name. When the header parser is creating your field for you at header generation time, it enters StaticAllocateObject (in UOBjectGlobals.cpp) that then does this:

 if(InName == NAME_None)
     InName = MakeUniqueObjectName( InOuter, InClass );

This should explain why you're getting a default looking name rather than what you specified. I'd suggest using a different name, perhaps "Zero" in your example case?

more ▼

answered Dec 03 '14 at 09:55 AM

avatar image

BrɑκеPɑd STAFF
1.4k 33 22 78

avatar image FrostSnake Dec 03 '14 at 11:17 AM

Oh, okay thanks for clearing things out :D

Since I was creating some sort of StatusEffect Struct, and I used None to indicate no status effect is applied.

Anyone im using NoStatusEffect instead of None, Thanks for your quick response :D

(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