No Owning Connection Actor....with Spawn Actor

I’m trying to Spawn an item, place it in the world, and allow players to pick it up. However, after spawning the actor, when the player tries to pick it up, I encounter the ‘No Owning Connection…’ issue due to the lack of an owner. I’ve heard that objects placed in the World Editor can have this problem, so I tried calling SpawnActor from the GameMode and setting the GameMode as the owner, but the same issue occurred. For your information, the replication settings are completed for this actor, including the actor itself and its internal components. What should I do to replicate this item successfully?

SpawnActor and the Object is visible to everyone, but when a client tries to pick up the item, the ‘No Owning Connection’ issue occurs

Can you show the pick up code

Yes, This is pick up code

Press F is Call OnInteract
LookAtActor(Target) Is Item 
void ACPlayer::OnInteract()
{
	Inventory->Server_Interact_Implementation(Inventory->LookAtActor);
}

// Is Call here CInventoryComponent.cpp
void UCInventoryComponent::Server_Interact_Implementation(class AActor* Target)
{
	if (!!Target)
	{	
		UCItemDataComponent* item = CHelpers::GetComponent<UCItemDataComponent>(Target);
		if (!!item)
		{
// Item Interact
			item->Execute_InteractWith(item, Cast<ACharacter>(GetOwner()));
		}
	}
}
....
bool UCItemDataComponent::InteractWith_Implementation(class ACharacter* InPlayerCharacter)
{
	UCInventoryComponent* inventory = CHelpers::GetComponent<UCInventoryComponent>(InPlayerCharacter);
	if (!!inventory)
	{
		int32 remainQuantity;
		if (inventory->AddToInventory(ItemID.RowName, Quantity, remainQuantity))
		{
			Test();
			return true;

		}
		CLog::Log("AddToInventoryFail");
	}
	return false;
}

void UCItemDataComponent::Test_Implementation() // Server Code
{
	GetOwner()->Destroy();
}

Even if AddToInventory() succeeds, the Client cannot delete the Item.
With No Owning Connection Actor…

Hmm can you show the full error message ?

Looks like your player is calling Server_Interact_Implementation() directly. If this is a server RPC you should call Server_Interact() only, and the _Implementation code will be executed by server automatically.

Once you are on server, there should be no issue destroying the actor. If the actor is replicated, the destruction will happen on all clients.

1 Like

Client should do a local interaction “Test”. If it is successful, RPC the server to interact.

1 Like

Sorry It’s My fault.
I’ve resolved it. I forgot not to call the _Implementation is Server call.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.