Description

FConsoleVariable::OnChangedCallback was changed to a multicast delegate in 4.26.
Along with this, FConsoleVariableBase::SetOnChangedCallback was implemented to emulate a single delegate for compatibility, but it actually behaves incompatibly.

The following workaround works

	virtual void SetOnChangedCallback(const FConsoleVariableDelegate& Callback) 
	{
		OnChangedCallback.Remove(LegacyDelegateHandle);
#if 0
		OnChangedCallback.Add(Callback); 
#else
		LegacyDelegateHandle = OnChangedCallback.Add(Callback); 
#endif
	}

Steps to Reproduce

1. Call FConsoleVariableBase::SetOnChangedCallback multiple times

Result:

All delegates were registered.

Expected Result:

Only the last delegate was registered.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-118429 in the post.

0
Login to Vote

Unresolved
ComponentRendering - Niagara
Target Fix5.0
CreatedJun 17, 2021
UpdatedJun 17, 2021