The local variable "canEditScene" doesn't check if any scene is loaded, the EditingSceneState type overrides the CanEditScene property to always return true which makes the check necessary.