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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

May I use "PlayerID" as my ustruct member variable name?

If I use this name (`PlayerID`) as my struct member variable name, then in ModuleName.generated.cpp i get this generated line:

 UProperty* NewProp_PlayerId = new(ReturnStruct, TEXT("PlayerId"), RF_Public|RF_Transient|RF_Native) UIntProperty(CPP_PROPERTY_BASE(PlayerId, FPlayerData), 0x0000000000000000);

instead of:

 UProperty* NewProp_PlayerID = new(ReturnStruct, TEXT("PlayerID"), RF_Public|RF_Transient|RF_Native) UIntProperty(CPP_PROPERTY_BASE(PlayerID, FPlayerData), 0x0000000000000000);

and this causes error about that my struct doesn't have PlayerId member. Is this some kind of engine restriction or is it a bug?

Product Version: Not Selected
Tags:
more ▼

asked Jul 20 '14 at 05:55 AM in C++ Programming

avatar image

TimGS
621 20 23 236

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

1 answer: sort voted first

That looks like an FName issue.

Unfortunately, due to the way FNames work (which is what the UHT uses when parsing those variables), if it sees a variable called PlayerId before PlayerID, it will always produce code using PlayerId (as FName is case-insensitive, and not case-preserving) :(

Using PlayerId as your variable name should "fix" the issue for now.

more ▼

answered Jul 20 '14 at 12:44 PM

avatar image

Jamie Dale STAFF
7.5k 176 66 304

avatar image Jamie Dale STAFF Sep 23 '14 at 11:18 AM

We've made a change for 4.5 which will make FName case-preserving for the editor and UHT. This should address the FName case issues you've been seeing.

I've checked that you're able to rename asset, actor, and blueprint components in a way that changes only their case. I've also tested that you're able to have a variables in different UObject/UStruct types that vary only by case, and that the UHT will generate code that actually compiles.

(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