4.21 - 4.22 Motion Controllers stopped responding

Hi everyone,

It’s coming from their all new HasLocalNetOwner() which should normally crashed when the owner is the level. And instead always returns false;

bool AActor::HasLocalNetOwner() const
{
	// I might be the top owner if I am a Pawn or a Controller (owner will be null)(Epic's comment)
	const AActor* TopOwner = this;

	// Epic tries to retreive the last owner
	if (Owner != nullptr)
	{
		// I have an owner so search that for the top owner (Epic's comment)
		for (TopOwner = Owner; TopOwner->Owner; TopOwner = TopOwner->Owner)
		{
		}
	}

	// Top owner will normally be a Pawn or a Controller (Epic's comment)
	// WRONG !! It can be the level itself in case of spawning an actor from it !
	if (const APawn* Pawn = Cast<APawn>(TopOwner))
	{
		return Pawn->IsLocallyControlled();
	}

	// The level hasn't got controller so normally "Controller->IsLocalController()" should crash the engine
	const AController* Controller = Cast<AController>(TopOwner);
	return Controller && Controller->IsLocalController();
}

That’s really strange that code has successfully passed the Q&A tests.

Anyway, in your FActorSpawnParameters.Owner, make it to nullptr and maybe should do the trick.

UPDATE : That worked for me I got back my controllers. Now the Custom Depth haha :stuck_out_tongue:

Best regards,

Alexandre

This Worked For me Thank You!

I just had to update a project from 4.18 all the way to 4.24 and also encountered this error when doing the step from 4.21 to 4.22, just like Alexandre_Marie said, it was caused by the HasLocalNetOwner() being introduced, but for me the fix was not to set the Owner to null, but the opposite. It was set to null and setting it to the owning ACharacter (APawn descendant) after spawning the controller fixed my issue, I set the owner like this in the class owning it.

MotionController->SetOwner(this);