Hi @ptitbgdu80 and @Anonymous_c0b2ef1d8b6296d661f82020eeaf73de,
Removing line 513 is not really a solution to the problem.
This is a bug in the UE code on line 513.
It should probably be:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));
instead of:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, (TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));
Actually the problem is in the substring:
(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString())
This line is like:
const TCHAR *value = (TEXT("some value"), name1.CalculateString(), name2.CalculateString());
or
auto a = (op1(), op2(), op3());
the results of calling op1 and op2 will be ignored, but only op3() will be assigned to a.
So, if op1 or op2 has a “nodiscard” attribute, Visual Studio will generate an error/warning.
The previous version of Visual Studio did not have this behavior. New Visual Studio update - has.
The actual nodiscard attribute that can cause this error in this situation is UnrealString.h, line 324:
/**
* Get pointer to the string
*
* @Return Pointer to Array of TCHAR if Num, otherwise the empty string
*/
UE_NODISCARD FORCEINLINE const TCHAR* operator*() const UE_LIFETIMEBOUND
{
return Data.Num() ? Data.GetData() : TEXT("");
}
To sum up, the solution would be to use this line instead of line 513:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));