// Function called when Unity player is killed. private void OnApplicationQuit() { // Close ZMQ sockets pull_socket.Close(); push_socket.Close(); Debug.Log("Terminated ZMQ sockets."); NetMQConfig.Cleanup(); }