Пример #1
0
void UActorComponent::DestroyComponent()
{
	// First, unregister if registered
	if(IsRegistered())
	{
		UnregisterComponent();
	}

	// Then remove from Components array, if we have an Actor
	AActor* Owner = GetOwner();
	if(Owner != NULL)
	{
		Owner->SerializedComponents.Remove(this);
		if (Owner->GetRootComponent() == this)
		{
			Owner->SetRootComponent(NULL);
		}
	}

	// Tell the component it is being destroyed
	OnComponentDestroyed();

	// Finally mark pending kill, to NULL out any other refs
	MarkPendingKill();
}
Пример #2
0
void ANavigationData::CleanUpAndMarkPendingKill()
{
	CleanUp();
	SetActorHiddenInGame(true);

	// do NOT destroy here! it can be called from PostLoad and will crash in DestroyActor()
	MarkPendingKill();
	MarkComponentsAsPendingKill();
}
Пример #3
0
void UUserWidget::OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld)
{
	// If the InLevel is null, it's a signal that the entire world is about to disappear, so
	// go ahead and remove this widget from the viewport, it could be holding onto too many
	// dangerous actor references that won't carry over into the next world.
	if ( InLevel == nullptr && InWorld == GetWorld() )
	{
		RemoveFromParent();
		MarkPendingKill();
	}
}
Пример #4
0
void UUnitTest::CleanupUnitTest()
{
	if (GUnitTestManager != NULL)
	{
		GUnitTestManager->NotifyUnitTestCleanup(this);
	}
	else
	{
		// Mark for garbage collection
		MarkPendingKill();
	}
}
Пример #5
0
void UGameplayTask::OnDestroy(bool bInOwnerFinished)
{
    ensure(TaskState != EGameplayTaskState::Finished && !IsPendingKill());
    TaskState = EGameplayTaskState::Finished;

    if (TasksComponent.IsValid())
    {
        TasksComponent->OnGameplayTaskDeactivated(*this);
    }

    MarkPendingKill();
}
Пример #6
0
void UGame::Shutdown()
{
	if ( IsPendingKill() )
	{
		return;
	}

	OnShutdown();

	ObjectTree->Dispose();

	MarkPendingKill();
}
Пример #7
0
void UActorComponent::DestroyComponent(bool bPromoteChildren/*= false*/)
{
	// Avoid re-entrancy
	if (bIsBeingDestroyed)
	{
		return;
	}

	bIsBeingDestroyed = true;

	if (bHasBegunPlay)
	{
		EndPlay(EEndPlayReason::Destroyed);
	}

	// Ensure that we call UninitializeComponent before we destroy this component
	if (bHasBeenInitialized)
	{
		UninitializeComponent();
	}

	// Unregister if registered
	if(IsRegistered())
	{
		UnregisterComponent();
	}

	// Then remove from Components array, if we have an Actor
	if(AActor* MyOwner = GetOwner())
	{
		if (IsCreatedByConstructionScript())
		{
			MyOwner->BlueprintCreatedComponents.Remove(this);
		}
		else
		{
			MyOwner->RemoveInstanceComponent(this);
		}
		MyOwner->RemoveOwnedComponent(this);
		if (MyOwner->GetRootComponent() == this)
		{
			MyOwner->SetRootComponent(NULL);
		}
	}

	// Tell the component it is being destroyed
	OnComponentDestroyed();

	// Finally mark pending kill, to NULL out any other refs
	MarkPendingKill();
}
Пример #8
0
void UAbilityTask::OnDestroy(bool AbilityIsEnding)
{
	ensure(!IsPendingKill());

	// If this task required ticking, unregister it with AbilitySystemComponent
	if (AbilitySystemComponent.IsValid())
	{
		AbilitySystemComponent->TaskEnded(this);
	}

	// Remove ourselves from the owning Ability's task list, if the ability isn't ending
	if (!AbilityIsEnding && Ability.IsValid())
	{
		Ability->TaskEnded(this);
	}

	MarkPendingKill();
}
void UGameplayTask::OnDestroy(bool bOwnerFinished)
{
	ensure(TaskState != EGameplayTaskState::Finished && !IsPendingKill());

	TaskState = EGameplayTaskState::Finished;

	// First of all notify the TaskComponent
	if (TasksComponent.IsValid())
	{
		TasksComponent->OnTaskDeactivated(*this);
	}

	// Remove ourselves from the owner's task list, if the owner isn't ending
	if (bOwnedByTasksComponent == false && bOwnerFinished == false && TaskOwner.IsValid() == true)
	{
		TaskOwner->OnTaskDeactivated(*this);
	}

	MarkPendingKill();
}