# SpawnParams.Template-\>GetOwner() keeps returning null

**URL:** <https://forums.unrealengine.com/t/spawnparams-template-getowner-keeps-returning-null/486402>\
**Category:** Community & Industry Discussion\
**Tags:** tmap, unreal-engine, template, question\
**Created:** [July 19, 2021, 6:29pm UTC](https://forums.unrealengine.com/t/spawnparams-template-getowner-keeps-returning-null/486402 "2021-07-19T18:29:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Walid\_Chekkouri](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/walid_chekkouri/32/1194685_2.png) [@Walid\_Chekkouri](https://forums.unrealengine.com/u/Walid_Chekkouri)\
**Post date:** [July 19, 2021, 6:29pm UTC](https://forums.unrealengine.com/t/spawnparams-template-getowner-keeps-returning-null/486402/1 "2021-07-19T18:29:26Z")

</div>

I’m trying to store the Actor FActorSpawnParameters inside of a TMap, this will help me later in the widget to get which element of the inventory is my actor, however when storing the inside the TMap and trying to access the owner of an element it keeps returning null.  
This is the code to save the info of the actor which we want to add to our TMap  
FActorSpawnParameters SpawnParams = FActorSpawnParameters();  
Original-\>SetOwner(this);  
SpawnParams.Template = Original;  
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;  
auto ActorClass = Original-\>GetClass();  
SpawnParams.Owner = this;  
SpawnParams.Instigator = this;  
SpawnParams.Template-\>SetOwner(this);  
TSharedPtr InventoryTupleValue = MakeShared\< FInventoryTupleKey\>(1, SpawnParams);  
InventoryElements.Add(ActorClass, InventoryTupleValue);

However when trying to iterate over the map, it seems that the e\GetOwner() returns nullptr? Why is that? This returns no owner message always.

```
	for (auto KeyValuePair : InventoryElements)
	{
		if (KeyValuePair.Value->ActorSpawnParams.Template->GetOwner())
		{
			UE_LOG(LogTemp, Warning, TEXT("# Class OWNER is %s"), *KeyValuePair.Value->ActorSpawnParams.Template->GetOwner()->GetFName().ToString());
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("# no owner"));
			KeyValuePair.Value->ActorSpawnParams.Template->SetOwner(this);
		}
			
	}
```
