Stereo Layer isn't destroyed on end play

When a stereo layer is present rendering a widget it doesn’t get removed from the HMD until quitting SteamVR or the editor.

This can be reproduced in 4.20.2 by:

  1. Open a blank project
  2. Add a widget component and a stereo layer component as children to a camera in a pawn
  3. Add a widget with some dummy text to the widget component
  4. Set the stereo layer texture to the widget’s render texture
  5. Play PIE
  6. Stop PIE

I’ve narrowed the bug to this commit which was introduced in 4.20.2.

EnableStereo(false) is called here which is called before BeginDestroy and thereby blocking the call to DestroyLayer().

It seems to me that checking against IsStereoEnabled is unnecessary as GetStereoLayers() would return nullptr anyway if there was nothing to remove, and if by chance there was any stereo layer to destroy even with IsStereoEnabled() == false one would still want to destroy it.

1 Like