Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

NetworkMigrationManager.FindNewHost

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public function FindNewHost(out newHostInfo: Networking.NetworkSystem.PeerInfoMessage, out youAreNewHost: bool): bool;
public bool FindNewHost(out Networking.NetworkSystem.PeerInfoMessage newHostInfo, out bool youAreNewHost);

Parameters

newHostInfo Information about the new host, including the IP address.
youAreNewHost True if this client is to be the new host.

Returns

bool True if able to pick a new host.

Description

This is a utility function to pick one of the peers in the game as the new host.

This function implements the default host-choosing strategy of picking the peer with the lowest connectionId on the server.

Applications are not required to use this function to choose the new host. They can use any method they want. The choice does not have to be made synchronously, so it is possible to communicate with an external service to choose the new host.

However, the default UI of the NetworkMigrationManager calls into this function.