InitializeComponent() inside BP

I have custom component:

void UObjectSpawner::InitializeComponent()
{
	Super::InitializeComponent();

	if (Check)
	{
		UWorld* const World = ();
		if (World)
		{
			if (Object)
			{
				SpawnedObject = World->SpawnActor<AActor>(Object, GetComponentLocation() + OffsetPosition.GetLocation(), GetComponentRotation() + OffsetPosition.Rotator());
			}
		}
	}
}


// Called every frame
void UObjectSpawner::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
{
	Super::TickComponent( DeltaTime, TickType, ThisTickFunction );

	if (!doOnce)
	{
		if (SpawnedObject)
		{
			SpawnedObject->SetActorScale3D(OffsetPosition.GetScale3D());
		}
		doOnce = true;
	}
}

This component must spawn BPs from other BP. But it spawning object every time i change property(like Construction script).

How to remove previous spawned object (Destroy() - dont help)? I dont want to disable this because it’s helpful.

And, you can see in code, i apply scale after game starts inside Tick. Is it possible to apply it somehow in InitializeComponent()?

P.S. Sorry for my English.

Try on component registration, which as discription say is for “creating any rendering/physics state”:

Considering it a object spawner, didn’t you though of using timer? which you could check if it’s already initiated on InitializeComponent, you can also use that with bool varable

Thx, but i don’t need it more.