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 Questions & Answers just mention UE-118429 in the post.

0
Login to Vote

Fixed
ComponentUE - Niagara
Target Fix5.0
Fix Commit18790135
Main Commit18790880
Release Commit18790135
CreatedJun 17, 2021
ResolvedJan 31, 2022
UpdatedJan 26, 2023
View Jira Issue