Member variable declaration: 'AmmoTypeDefaults' already defined
On Server and client functions i can’t use names for the parameters like FRotator Rotator, or other variable names that i have defined on other classes. Example:
On my item class i have a int32 Quantity variable, if i declare a server function (it might not even be on the same class or file) with a parameter int32 Quantity it will say:
Function parameter: 'Quantity' conflicts with previously defined field in 'Item'
Can you please explain why does this happen and if it’s really a bug. Thank you.
Can you provide a sample simple/blank project that demonstrates the issue? This helps with testing, but also allows you to verify if it’s a problem with your specific project.
Information regarding which UE version and if it’s a source/launcher build you’re using would be helpful, too.
UHT (UnrealHeaderTool) generates code based on dummy macros like UPROPERTY (they do nothing during compilation) and rest of the header file code (function names etc.), that code is for reflation system and other fancy features you see in UMACROs making UE4 coding a lot easier. So your code collides with generated code, whatever this is bug depends if you consider rules forced by UHT as conventions. Btw you can find generated code somewhere in Intermidite directory in your project directory
Yes I assumed that, but it’s a bit of a bummer not being able to name variables the way you want, to maintain consistency I would like to know if Epic plans on leaving it like this or are they thinking about changing something like putting prefix or suffixes (like GEN_) so it has less probability of colliding.
Due to the way that the Unreal Build Tool processes Unreal classes, it does not differentiate between the names of UPROPERTYs and the names of parameters of UFUNCTIONs. If the same name is used for a variable and a function parameter, the compiler will think that you are declaring the same variable twice. This is an unfortunate limitation of Unreal classes.
If either the variable or the parameter is not defined as being a UPROPERTY or part of a UFUNCTION, then this should not be a problem.