Changing device profile is very long

Hi!

We are woking on a game on console platofrm.

And we have several device profiles.

Unfortunatelly in game, when we switch from quality to performance, it could take up to 20s to change.

The issue comes from :

`Manager.SetOverrideDeviceProfile(NewDeviceProfile);`

which in the end makes several calls to

`FGlobalComponentRecreateRenderStateContext RecreateRenderStateContext;`

I followed a little bit the spirit of `ActiveGlobalRecreateRenderStateContextCount` :

and I added a bool to avoid the call to be able to be done

```

FGlobalComponentRecreateRenderStateContext::FGlobalComponentRecreateRenderStateContext()

{

if(FApp::CanEverRender() && !bManualStopRecreation)

```

But with `bManualStopRecreation` being explicitly called to stop the recreation to be done.

It seems to work, but I was wondering why `ActiveGlobalRecreateRenderStateContextCount`is not usable.

Now we do :

	UDeviceProfileManager& Manager = UDeviceProfileManager::Get();
	FString NewDeviceProfileName  = GetBestDeviceProfileName();

	if (Manager.GetActiveDeviceProfileName() != NewDeviceProfileName)
	{
		UDeviceProfile* NewDeviceProfile = Manager.FindProfile(NewDeviceProfileName, true);

		if(NewDeviceProfile != nullptr)
		{
			FGlobalComponentRecreateRenderStateContext::ManuallyBlockRecreation();

			TRACE_BOOKMARK(TEXT("Change for Profile : %s"), *NewDeviceProfileName);
			Manager.RestoreDefaultDeviceProfile();
			Manager.SetOverrideDeviceProfile(NewDeviceProfile);
			UE_LOG(LogConsoleResponse, Log, TEXT("Overrided Device Profile: [%s]"), *NewDeviceProfileName);
 
			FGlobalComponentRecreateRenderStateContext::ManuallyAllowRecreation();
			// force refresh to avoid rendering glitches
			FGlobalComponentRecreateRenderStateContext RecreateRenderStateContext;
 
		}
	}

Do it feel safe for you?

If there another way to block the recreation when calling the sink of all cvars?

Thanks

[Attachment Removed]

Hello,

Thank you for reaching out.

An issue was observed with the ActiveGlobalRecreateRenderStateContextCount and was removed due to potential crashes from stale skin cache data.

Here is a related ticket that talks about a similar issue:

[Content removed]

This bug that was created as a result and contains commits that shows the details of this work.

https://issues.unrealengine.com/issue/UE-296881

Based on the known issue, we would advise stress testing your changes with skinned meshes.

Please let us know if this helps.

[Attachment Removed]