Game > GameAnvil > Unity Basic Development Guide > GameAnvilConnector

GameAnvilConnector

The GameAnvilConnector is responsible for basic setup and agent management, and can set options or register callbacks to view logs related to its internal behavior. To use GameAnvilConnector, you must first create a GameAnvilConnector.

Create

Create a GameObject and add the GameAnvilConnector component. You can add it as a component by selecting Add Component > GameAnvil > GameAnvilConnector.

Alternatively, you can create it directly from the Unity Hierarchy by right-clicking and selecting GameAnvil > GameAnvilConnector.

Settings

There are settings used for GameAnvilConnector behavior. These are set to the default values when the GameAnvilConnector is created, but you can change them directly in the inspector window if needed.

There are the following types of settings

Name Description Default value
defaultReqestTimeout TimeOut default wait time 3(sec)
packetTimeout If the packet is not updated within the specified time, it is assumed to be disconnected. Must be set to a value greater than pingInterval. 5(sec)
pingInterval Ping frequency to check connectivity with the server. Set to 0 if not used. 3(sec)
useIPv6 Whether to convert an IPv4 address to an Ipv6 address when connecting to a server using an IPv4 address in an IPv6 environment. false
useSocketNoDelay Whether the socket uses Nodelay true
useArgumentDelegateOnly Option to have only the callbacks passed in as parameters called, not the callbacks registered to the listener. true
Request Direct If the request is not waiting for a response when it is called, it is sent directly to the server without queuing it. true

Log

GameAnvilConnector does not log directly, but rather passes logs through a callback. You can register a listener to the OnLogMessage callback to print the log messages that are passed, as shown below.

GameAnvilConnector.getInstance().OnLogMesseage.AddListener(log => Debug.Log("OnLogMesseage test : " + log));

There are settings used in the GameAnvilConnector logs.

There are the following types of settings

Name Description Default value
Use Debug Log Whether to output GameAnvilConnector internal logs true
Enable Ping Pong Logs Whether to output logs generated by PingPong false
Log Level GameAnvilConnector Log Levels Info
on Log Message (String) A callback that passes the GameAnvilConnector internal logs as a string -

The GameAnvilConnector is now ready for use.

TOP