# AI Controller spawned by AutoPossessAi doesn't possess the character

**URL:** <https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932>\
**Category:** AI\
**Tags:** possess, aicontroller, unreal-engine, pawn, question\
**Created:** [June 15, 2021, 11:14am UTC](https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932 "2021-06-15T11:14:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackxBlack](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JackxBlack](https://forums.unrealengine.com/u/JackxBlack)\
**Post date:** [June 15, 2021, 11:14am UTC](https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932/1 "2021-06-15T11:14:26Z")

</div>

Hello,

I’ve recently ran into an issue where my AI Controller doesn’t possess it’s pawn. The controller itself is spawned by using the AutoPossessAI set to Placed in World or Spawned. It does spawn correctly, but just for some reason doesn’t possess. The character doesn’t have a different controller. Both Pawn on Controller and Controller or Character are null. Any idea what might be going on?

A bit more context:  
AI Controller is a C++ class:

```
UCLASS()
class GP2_API AGP2_AIController : public AAIController
{
  //stuff
}

```

Then I create a Blueprint class that takes this AGP2\_AIController as parent and change nothing there:

 ![341516-controller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/9/2a9e2a27a69faa2a4996074d20112779e81ef04c.png)

The character has seemingly all set up correctly:

 ![341517-character-auto-possess.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/5/af57f822080e800a018d55a2ec5ade310330ca8b.png)

Characters are spawned by an unrelated otherwise class simply like this:

```
ACharacterBase* TempCharacter = GetWorld()->SpawnActor<ACharacterBase>(CurrentClass, SpawnLocation, FRotator());

```

Proof that Controller and Pawn are null respectively:

 ![341519-no-pawn.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/4/f/d4f1a7431e9d1171bf25e3df9338e8b929a44dfe.png)

 ![341520-nocontroller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/f/05f304e9dc0f344958bd21b086f8aabf7d35acd3.png)

---

<div class="post-metadata">

**Author:** ![Kehel18](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kehel18](https://forums.unrealengine.com/u/Kehel18)\
**Post date:** [June 15, 2021, 2:15pm UTC](https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932/2 "2021-06-15T14:15:58Z")

</div>

Hello! This might be helpful [https://answers.unrealengine.com/questions/1004334/spawn-actor-and-aicontroller-problem.html](https://answers.unrealengine.com/questions/1004334/spawn-actor-and-aicontroller-problem.html)

---

<div class="post-metadata">

**Author:** ![JackxBlack](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JackxBlack](https://forums.unrealengine.com/u/JackxBlack)\
**Post date:** [June 15, 2021, 2:42pm UTC](https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932/3 "2021-06-15T14:42:21Z")

</div>

Hello. Thanks for the suggestion, but I don’t think that’s it. I’m checking if the pawn is possessed/controller is possessing way into the game, not at the very beginning. They just remain unpossessed, even after multiple seconds/minutes.

---

<div class="post-metadata">

**Author:** ![JackxBlack](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JackxBlack](https://forums.unrealengine.com/u/JackxBlack)\
**Post date:** [June 16, 2021, 6:51am UTC](https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932/4 "2021-06-16T06:51:57Z")

</div>

Slight update: I also tried disabling autopossess, spawning controller and possessing manually, but the effect is the same. Here’s code:

```
ACharacterBase* TempCharacter = GetWorld()->SpawnActor<ACharacterBase>(CurrentClass, SpawnLocation, FRotator());

		if (!TempCharacter)
		{
			UE_LOG(LogTemp, Error, TEXT("Character was not spawned!"));
			return;
		}		
		AGP2_AIController* TempController = GetWorld()->SpawnActor<AGP2_AIController>(AGP2_AIController::StaticClass(), SpawnLocation, FRotator());
		if (!TempController)
		{
			UE_LOG(LogTemp, Error, TEXT("AI Controller was not spawned!"));
			return;
		}
		TempController->Possess(TempCharacter);

```

Don’t see anything related in log.

---

<div class="post-metadata">

**Author:** ![JackxBlack](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JackxBlack](https://forums.unrealengine.com/u/JackxBlack)\
**Post date:** [June 16, 2021, 7:27am UTC](https://forums.unrealengine.com/t/ai-controller-spawned-by-autopossessai-doesnt-possess-the-character/484932/5 "2021-06-16T07:27:32Z")

</div>

Ok, mystery solved. Turned out to be a dumb mistake on my end. I’ve overriden OnPossess() on the AI Controller, but didn’t use Super::OnPossess(). Addint it solved the issue.
