Skip to main content
Version: 5.15.0

Calling Handler From Unity's Main Thread

The previous error handler received responses from external threads to handle error checks. However, from the 5.12.0 version, there is no longer a need to declare Poll, as the server request operates in the main thread.

Example

public class BackendErrorManager : MonoBehaviour {

void Start() {

if(Backend.IsInitialized) {
Backend.ErrorHandler.OnMaintenanceError = () => {
Debug.Log("Maintenance error occurred!!!");
gameObject.GetComponentInChildren<Text>().text = "Under maintenance.";
};
Backend.ErrorHandler.OnTooManyRequestError = () => {
Debug.Log("403 error occurred!!!");
gameObject.GetComponentInChildren<Text>().text = "Excessive requests detected.";
};
Backend.ErrorHandler.OnTooManyRequestByLocalError = () => {
Debug.Log("403 local error occurred!!!");
gameObject.GetComponentInChildren<Text>().text = "Excessive requests.";
};
Backend.ErrorHandler.OnOtherDeviceLoginDetectedError = () => {
Debug.Log("Cannot refresh!!!");
gameObject.GetComponentInChildren<Text>().text = "Login detected from another device.";
};
}
}
}