All UFUnctions and UProperties are stored internally in one list that shares the same outer object (the UClass). They have to have different names otherwise the internal hashing of UObjects algorithm would fail.
If the name of a UFUNCTION parameter matches the name of a previously defined UPROPERTY variable, the project will fail compile due to the following reason:
Function parameter: '[Variable/Paramter Name]' conflicts with previously defined field in 'MyActor'
Workaround:
Defining the function before defining the variable allows the code to compile without error.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test) class AMyActor2* thisVar; public: UFUNCTION(BlueprintCallable, Category = Test) void AFunctionName(AMyActor2* thisVar);
void AMyActor::AFunctionName(AMyActor2* thisVar)
{
this->thisVar = thisVar;
}
Result:
Compile fails with error message listed in description
Expected:
Parameter name is independent of variable names
Repro Rate:
3/3
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 4.10.4 |
Target Fix | 4.12 |
Created | Feb 29, 2016 |
---|---|
Resolved | Mar 22, 2016 |
Updated | Feb 5, 2017 |