bCheckReferencesOnDelete

bCheckReferencesOnDelete

#Overview

name: bCheckReferencesOnDelete

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bCheckReferencesOnDelete is to control whether the Unreal Editor checks for references to objects before deleting them. This setting is primarily used in the editing and deletion processes within the Unreal Engine editor.

This setting variable is relied upon by the Unreal Engine’s editor subsystem, specifically within the UnrealEd module. It’s used in various editor-related operations, particularly when deleting actors or selected elements in the level editor.

The value of this variable is set in the LevelEditorMiscSettings class, which is part of the editor’s configuration settings. It’s defined as a UPROPERTY, which means it can be modified through the editor’s project settings interface.

This variable interacts with deletion operations in the editor. When enabled, it forces the editor to check for references before deleting objects, which can help prevent unintended consequences of deleting objects that are referenced elsewhere in the project.

Developers must be aware that disabling this setting is considered advanced usage and not recommended. Disabling reference checks during deletion can lead to dangling references and potential crashes or unexpected behavior in the editor or game.

Best practices when using this variable include:

  1. Keeping it enabled in most cases to ensure safe deletion of objects.
  2. Only disabling it if you have a specific, advanced use case that requires bypassing reference checks.
  3. If disabling it, ensure you have a thorough understanding of your project’s object references to avoid creating issues.
  4. Consider re-enabling it after performing any operations that required it to be disabled.
  5. Be cautious when modifying this setting, as it can affect the stability and integrity of your project.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:207, section: [/Script/UnrealEd.LevelEditorMiscSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorMiscSettings.h:49

Scope (from outer to inner):

file
class        class ULevelEditorMiscSettings : public UDeveloperSettings

Source code excerpt:

	/** If enabled, will force checking references during a delete. Note: disabling this is for advanced usage only and not recommended.*/
	UPROPERTY(EditAnywhere, config, AdvancedDisplay, Category = Editing, meta = (DisplayName = "Check References on Delete"))
	uint32 bCheckReferencesOnDelete:1;

public:
	/** If checked audio playing in the editor will continue to play even if the editor is in the background */
	UPROPERTY(EditAnywhere, config, Category=Sound)
	uint32 bAllowBackgroundAudio:1;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Subsystems/EditorActorSubsystem.cpp:286

Scope (from outer to inner):

file
function     void UEditorActorSubsystem::DeleteSelectedActors

Source code excerpt:


	FEditorDelegates::OnDeleteActorsBegin.Broadcast();
	const bool bCheckRef = GetDefault<ULevelEditorMiscSettings>()->bCheckReferencesOnDelete;
	GEditor->edactDeleteSelected(InWorld, true, bCheckRef, bCheckRef);
	FEditorDelegates::OnDeleteActorsEnd.Broadcast();
}

void UEditorActorSubsystem::InvertSelection(UWorld* InWorld)
{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:1517

Scope (from outer to inner):

file
function     bool UUnrealEdEngine::Exec_Edit

Source code excerpt:


						CommonActions->CopySelectedElements(SelectionSet);
						const bool bCheckRef = GetDefault<ULevelEditorMiscSettings>()->bCheckReferencesOnDelete;
						FTypedElementDeletionOptions Options;
						Options
							.SetWarnAboutReferences(bCheckRef)
							.SetWarnAboutSoftReferences(bCheckRef);
						CommonActions->DeleteSelectedElements(SelectionSet, InWorld, Options);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:1538

Scope (from outer to inner):

file
function     bool UUnrealEdEngine::Exec_Edit

Source code excerpt:


			edactCopySelected(InWorld);
			const bool bCheckRef = GetDefault<ULevelEditorMiscSettings>()->bCheckReferencesOnDelete;
			edactDeleteSelected(InWorld, true, bCheckRef, bCheckRef);
		}
		else
		{
			const FScopedTransaction Transaction(NSLOCTEXT("UnrealEd", "Cut", "Cut"));
			FEditorDelegates::OnEditCutActorsBegin.Broadcast();

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:2599

Scope: file

Source code excerpt:

					{
						FEditorDelegates::OnDeleteActorsBegin.Broadcast();
						const bool bCheckRef = GetDefault<ULevelEditorMiscSettings>()->bCheckReferencesOnDelete;
						FTypedElementDeletionOptions Options;
						Options
							.SetWarnAboutReferences(bCheckRef)
							.SetWarnAboutSoftReferences(bCheckRef);
						CommonActions->DeleteSelectedElements(SelectionSet, InWorld, Options);
						FEditorDelegates::OnDeleteActorsEnd.Broadcast();