Version: 2018.2
네트워크 ID(Network Identity)
네트워크 로비 플레이어(Network Lobby Player)

네트워크 로비 매니저

NetworkLobbyManager는 게임의 메인 플레이 씬에 진입하기 전에 거치는 멀티플레이어 로비를 제공하는 특별한 형태의 NetworkManager 타입입니다. 이를 통해 다음과 같은 네트워크를 설정할 수 있습니다.

  • 최대 플레이어 수 제한
  • 모든 플레이어가 준비되면 자동 시작
  • 플레이어가 진행 중인 게임에 참여하는 것을 방지하는 옵션
  • “카우치 멀티플레이어”(즉 클라이언트 하나에 여러 플레이어) 지원
  • 플레이어가 로비에 있는 동안 옵션을 선택하는 커스터마이즈 가능한 방법

NetworkLobbyManager에는 두 가지 타입의 플레이어 오브젝트가 있습니다.

LobbyPlayer 오브젝트

  • 각 플레이어에 하나씩
  • 클라이언트가 연결하거나 플레이어가 추가될 때 생성
  • 클라이언트 연결 해제 시까지 지속
  • 준비 플래그와 설정 데이터 보유
  • 로비에서 커맨드 처리
  • NetworkLobbyPlayer 컴포넌트를 사용해야 함

GamePlayer 오브젝트

  • 각 플레이어에 하나씩
  • 게임 씬이 시작될 때 생성됨
  • 로비에 다시 입장하면 제거됨
  • 게임 내 커맨드 처리

프로퍼티

프로퍼티: 기능:
showLobbyGUI 로비의 개발자 OnGUI 컨트롤을 표시합니다.
maxPlayers 로비에 있을 수 있는 최대 플레이어 수입니다.
maxPlayersPerConnection 각 클라이언트 연결에 추가할 수 있는 최대 플레이어 수입니다.
lobbyPlayerPrefab 플레이어가 로비에 들어올 때 플레이어를 위해 만들 프리팹입니다.
gamePlayerPrefab 게임이 시작되면 플레이어를 위해 만들 프리팹입니다.
lobbyScene 로비에 사용할 씬입니다.
playScene 메인 게임 플레이에 사용할 씬입니다.

세부 정보

  • lobbyPlayerPrefab 슬롯은 NetworkLobbyPlayer 컴포넌트가 있는 오브젝트로 채워야 합니다.
  • 로비 매니저를 위한 GUI가 있습니다. 멀티플레이어-로비 에셋 패키지를 참조하십시오.

네트워크 로비 관리자(Network Lobby Manager)

Network Lobby Manager는 게임의 메인 플레이 씬에 진입하기 전에 사용이 편리한 멀티플레이어 로비를 제공하는 특수 NetworkManager 타입입니다.

Network Lobby Manager에는 멀티플레이어 게임에 일반적으로 사용되는 여러 기능이 내장되어 있습니다. 이 컴포넌트는 예를 들어 최대 플레이어 한도를 설정하고 모든 플레이어가 준비되면 게임을 자동으로 시작하는 기능과 플레이어가 진행 중인 게임에 참여하지 않도록 하는 옵션 등을 지원합니다. Network Lobby Manager는 여러 플레이어가 같은 클라이언트를 사용하여 함께 플레이하는 “카우치 멀티플레이어”도 지원합니다.

Network Lobby Manager 컴포넌트
Network Lobby Manager 컴포넌트
프로퍼티: 기능:
Show Lobby GUI 로비를 제어하는 개발자 GUI 컨트롤을 표시하려면 활성화합니다. 개발자의 편의를 위한 용도로만 사용해야 합니다. 완성된 게임에서 플레이어가 사용할 사용자 지정 UI를 생성해야 합니다.
Max Players 로비에 있을 수 있는 최대 플레이어 수입니다.
Max Players Per Connection 각 클라이언트 연결에 추가할 수 있는 최대 플레이어 수입니다.
Min Players 로비에 있어야 하는 최소 플레이어 수입니다.
Lobby Player Prefab 플레이어가 로비에 들어올 때 플레이어를 위해 만들 프리팹입니다.
Game Player Prefab 게임이 시작되면 플레이어를 위해 만들 프리팹입니다.
Lobby Scene 로비에 사용할 씬입니다.
씬 플레이(Play Scene) 메인 게임 플레이에 사용할 씬입니다.
Network Info You can expand this section of the inspector to access network-related settings, listed below
Use Web Sockets When running as a host, enable this setting to make the host listen for WebSocket connections instead of normal transport layer connections, so that WebGL clients can connect to it (if you build your game for the WebGL platform). These WebGL instances of your game cannot act as a host (in either peer-hosted or server-only mode). Therefore, for WebGL instances of your multiplayer game to be able to find each other and play together, you must host a server-only instance of your game running in LAN mode, with a publicly reachable IP address, and it must have this option enabled. This checkbox is unticked by default.
Network Address The network address currently in use. For clients, this is the address of the server that is connected to. For servers, this is the local address. This is set to ‘localhost’ by default.
Network Port The network port currently in use. For clients, this is the port of the server connected to. For servers, this is the listen port. This is set to 7777 by default.
Server Bind To IP Allows you to tell the server whether to bind to a specific IP address. If this checkbox is not ticked, then there is no specific IP address bound to (IP_ANY). This checkbox is unticked by default. Use this if your server has multiple network addresses (eg, internal LAN, external internet, VPN) and you want to specific the IP address to serve your game on.
Server Bind Address This field is only visible when the Server Bind To IP checkbox is ticked. Use this to enter the specific IP address that the server should bind to.
Script CRC Check When this is enabled, Unity checks that the clients and the server are using matching scripts. This is useful to make sure outdated versions of your client are not connecting to the latest (updated) version of your server. This checkbox is ticked by default. It does this by performing a (CRC check)[https://en.wikipedia.org/wiki/Cyclic_redundancy_check] between the server and client that ensures the NetworkBehaviour scripts match. This may not be appropriate in some cases, such as when you are intentionally using different Unity projects for the client and server. In most other cases however, you should leave it enabled.
Max Delay The maximum time in seconds to delay buffered messages. The default of 0.01 seconds means packets are delayed at most by 10 milliseconds. Setting this to zero disables HLAPI connection buffering. This is set to 0.01 by default.
Max Buffered Packets The maximum number of packets that a NetworkConnection can buffer for each channel. This corresponds to the ChannelOption.MaxPendingBuffers channel option. This is set to 16 by default.
Packet Fragmentation This allows the NetworkConnection instances to fragment packets that are larger than maxPacketSize, to up a maximum of 64K. This can cause delays in sending large packets. This checkbox is ticked by default.
MatchMaker Host URI The host address for the MatchMaker server. By default this points to the global Unity Multiplayer Service at mm.unet.unity3d.com, and usually you should not need to change this. Unity automatically groups players of your game into regional servers around the world, which ensures fast multiplayer response times between players in the same region. This means, for example, that players from Europe, the US, and Asia generally end up playing with other players from their same global region. You can override this value to explicitly control which regional server your game connects to. You might want to do this via scripting if you want to give your players the option of joining a server outside of their global region. For example, if “Player A” (in the US) wanted to connect to a match created via matchmaker by “Player B” (in Europe), they would need to be able to set their desired global region in your game. Therefore you would need to write a UI feature which allows them to select this. See API reference documentation on NetworkMatch.baseUri for more information, and for the regional server URIs.
MatchMaker Port The host port for the Matchmaker server. By default this points to port 443, and usually you should not need to change this.
Match Name Define the name of the current match. This is set to “default” by default.
Maximum Match Size Define the maximum number of players in the current match. This is set to 4 by default.
SpawnInfo You can expand this section of the inspector to access spawn-related settings, listed below
Player Prefab Define the default prefab Unity should use to create player GameObjects on the server. Unity creates Player GameObjects in the default handler for AddPlayer on the server. Implement (OnServerAddPlayer)[https://docs.unity.cn/ScriptReference/Networking.NetworkManager.OnServerAddPlayer.html] to override this behaviour.
Auto Create Player Tick this checkbox if you want Unity to automatically create player GameObjects on connect, and when the Scene changes. This checkbox is ticked by default. Note that if you are using the MigrationManager and you do not enable Auto Create Player, you need to call ClientScene.SendReconnectMessage when your client reconnects.
Player Spawn Method Define how Unity should decide where to spawn new player GameObjects. This is set to Random by default.
    Random Choose Random to spawn players at randomly chosen startPositions.
    Round Robin Choose Round Robin to cycle through startPositions in a set list.
Registered Spawnable Prefabs Use this list to add prefabs that you want the Network Manager to be aware of, so that it can spawn them. You can also add and remove them via scripting.
Advanced Configuration Tick this checkbox to reveal advanced configuration options in the Network Manager Inspector window.
    Max Connections Define the maximum number of concurrent network connections to support. This is set to 4 by default.
    Qos Channels A list containing the different communication channels the current Network Manager has, and the Quality Of Service (QoS) setting for each channel. Use this list to add or remove channels, and adjust their QoS setting. You can also configure the channels via scripting. For the descriptions of each QoS option, see QosType.
    Timeouts
        Min Update Timeout Set the minimum time (in milliseconds) the network thread waits between sending network messages. The network thread doesn’t send multiplayer network messages immediately. Instead, it check each connection periodically at a fixed rate to see if it has something to send. This is set to 10ms by default. See API reference documentation on MinUpdateTimeout for more information.
        Connect Timeout Define the amount of time (in milliseconds) Unity should wait while trying to connect before attempting the connection again. This is set to 2000ms by default. See API reference documentation on ConnectTimeout for more information.
        Disconnect Timeout The amount of time (in milliseconds) before Unity considers a connection to be disconnected. This is set to 2000ms by default. See API reference documentation on DisconnectTimeout for more information.
        Ping Timeout The amount of time (in milliseconds) between sending pings (also known as “keep-alive” packets). The ping timeout duration should be approximately one-third to one-quarter of the Disconnect Timeout duration, so that Unity doesn’t assume that clients are disconnected until the server has failed to receive at least three pings from the client. This is set to 500ms by default. See API reference documentation on ConnectionConfig.PingTimeout for more information.
    Global Config These settings relate to the Reactor. The Reactor is the part of the multiplayer system which receives network packets from the underlying operating system, and passes them into the multiplayer system for processing.
        Thread Awake Timeout The timeout duration in milliseconds, used by the Reactor. How the Reactor uses this value depends on which Reactor Model you select (see below). This is set to 1ms by default.
        Reactor Model Choose which type of reactor to use. The reactor model defines how Unity reads incoming packets. For most games and applications, the default Select reactor is appropriate. If you want to trade a small delay in the processing of network messages for lower CPU usage and improved battery life, use the Fix Rate reactor.
        Select Reactor This model uses the select() API which means that the network thread “awakens” (becomes active) as soon as a packet is available. Using this method means your game gets the data as fast as possible. This is the default Reactor Model setting.
        Fix Rate Reactor This model lets the network thread sleep manually for a given amount of time (defined by the value in Thread Awake Timeout) before checking whether there are incoming packets waiting to be processed.
        Reactor Max Recv Messages Set the maximum number of messages stored in the receive queue. This is set to 1024 messages by default.
        Reactor Max Sent Messages Set the maximum number of messages stored in the send queue. This is set to 1024 messages by default.
Use Network Simulator Tick this checkbox to enable the usage of the network simulator. The network simulator introduces simulated latency and packet loss based on the following settings:
    Simulated Average Latency The amount of delay in milliseconds to simulate.
    Simulated Packet Loss The amount of packet loss to simulate in percent.
네트워크 ID(Network Identity)
네트워크 로비 플레이어(Network Lobby Player)
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961