AOnlineBeaconHost and BeaconNetDriver problem

I am trying to spawn an AOnlineBeaconHost actor trough

BeaconHostListener = GetWorld()->SpawnActor<AOnlineBeaconHost>(AOnlineBeaconHost::StaticClass());

When i call the creation of the AOnlineBeaconHost actor i receive the log:

CreateNamedNetDriver failed to create driver from definition BeaconNetDriver

After that if I try to call InitHost() it returns false.
At first my game DefaultEngine.ini didn’t define a BeaconNetDriver and was

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

Then I examine the Unreal Tournament DefaultEngine.ini and updated mine

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="BeaconNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemUtils.OnlineBeaconHost]
ListenPort=7787
BeaconConnectionInitialTimeout=48.0
BeaconConnectionTimeout=49.0

Nevertheless nothing changed.
Someone know the proper way to create and init an AOnlineBeaconHost class actor?

I updated all the DefaultEngine.ini in my project (even in Saved folder) and resolved

Hey I’ve copied the above lines into my DefaultEngine.ini files.
There’s only 2 of those files, one in Config and one in Temp (I think the one in Temp is just a backup and not really changing anything?).

I still get the same error “CreateNamedNetDriver failed to create driver from definition BeaconNetDriver” whenever I try to InitHost().

Any other suggestions?
I’m currently in 4.17.

Create a new FNetDriverDefinition to add to GEngine’s NetDriverDefinitions, then restart the game/editor.

	FNetDriverDefinition BeaconDriverDefinition;
	BeaconDriverDefinition.DefName = NAME_BeaconNetDriver;
	BeaconDriverDefinition.DriverClassName = FName("/Script/OnlineSubsystemUtils.IpNetDriver");
	BeaconDriverDefinition.DriverClassNameFallback = FName("/Script/OnlineSubsystemUtils.IpNetDriver");

Thanks for the reply Shai.
Where do I add this piece of code?

It doesn’t matter, just be sure to call it and then restart the editor. Add a check, to prevent adding multiple definition, somethings like this before add the beacondriverdefinition

	for (auto& Definition : GEngine->NetDriverDefinitions)
	{
		if (Definition.DefName == NAME_BeaconNetDriver)
		{
			return;
		}
	}

I was running into the same issue, and instead of adding it via code, you can fix the ini file. It is supposed to be set in “[/Script/Engine.Engine]” not “[/Script/Engine.GameEngine]”

2 Likes

It‘s valid. Very good