private void OnSingleplayerGUI()
        {
            EditorGUILayout.Separator();

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Build for Singleplayer"))
            {
                if (!Directory.Exists(_buildFolder))
                {
                    SetBuildFolder();
                }

                if (_buildAndRun)
                {
                    BuildScripts.BuildAndRunSingleplayer64(_singleOnlyScene, _buildFolder, _devBuild, _buildTarget);
                }
                else
                {
                    BuildScripts.BuildSingleplayer64(_singleOnlyScene, _buildFolder, _devBuild, _buildTarget);
                }

                GUIUtility.ExitGUI();
            }

            if (GUILayout.Button("Run as Singleplayer"))
            {
                BuildScripts.PlayAsSingleplayer(_singleOnlyScene);
                GUIUtility.ExitGUI();
            }

            EditorGUILayout.EndHorizontal();
        }
        private void OnServerGUI()
        {
            EditorGUI.BeginChangeCheck();
            _socketPort = EditorGUILayout.IntField(new GUIContent("Socket Port", "The socket port used to host this server through."), _socketPort);

            if (EditorGUI.EndChangeCheck())
            {
                BuildScriptPrefs.SetSocketPort(_socketPort);
            }

            EditorGUILayout.Separator();

            var ip = IPUtils.GetLocalIPv4(NetworkInterfaceType.Ethernet);

            if (!string.IsNullOrEmpty(ip))
            {
                EditorGUILayout.DelayedTextField(new GUIContent("Ethernet IP v4 Address:", "Automatically identified local IP V4 address for Ethernet (Read Only)."), ip);
            }

            ip = IPUtils.GetLocalIPv4(NetworkInterfaceType.Wireless80211);
            if (!string.IsNullOrEmpty(ip))
            {
                EditorGUILayout.DelayedTextField(new GUIContent("Wireless IP v4 Address:", "Automatically identified local IP V4 address for Wireless (Read Only)."), ip);
            }

            EditorGUILayout.Separator();
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Build for Server"))
            {
                if (!Directory.Exists(_buildFolder))
                {
                    SetBuildFolder();
                }

                if (_buildAndRun)
                {
                    BuildScripts.BuildAndRunServer64(_serverOnlyScene, _buildFolder, _devBuild, _buildTarget, _socketPort);
                }
                else
                {
                    BuildScripts.BuildServer64(_serverOnlyScene, _buildFolder, _devBuild, _buildTarget, _socketPort);
                }

                GUIUtility.ExitGUI();
            }

            if (GUILayout.Button("Run as Server"))
            {
                BuildScripts.PlayAsServer(_serverOnlyScene, _socketPort);
                GUIUtility.ExitGUI();
            }

            EditorGUILayout.EndHorizontal();
        }
        private void RenderDeployment()
        {
            EditorGUILayout.LabelField(new GUIContent("Server Deployment", "Automatic deploment to Hetzner server using WinSCP."), EditorStyles.centeredGreyMiniLabel);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Reset Online Server"))
            {
                DeployScripts.ResetServers();
                GUIUtility.ExitGUI();
            }

            if (DeployScripts.DeployServersValidation())
            {
                if (GUILayout.Button("Deploy to Hetzner"))
                {
                    DeployScripts.DeployServers();
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Please make sure that you have built a server. Expecting to find server executable at path = " + DeployScripts.GetServerFilePath(), MessageType.Error);
            }

            if (GUILayout.Button("Build and Deploy"))
            {
                BuildScripts.BuildServer64(_serverOnlyScene, _buildFolder, false, BuildTarget.StandaloneLinux64, _socketPort);
                DeployScripts.DeployServers();
                GUIUtility.ExitGUI();
            }

            GUILayout.EndHorizontal();

            if (GUILayout.Button("Link to deployment google doc"))
            {
                Application.OpenURL(@"https://docs.google.com/document/d/1Ecy0n1JQWaICvW68l0zxcmgtMhjvU3e5twXNqi2jj_Q");
            }
        }
        private void OnClientGUI()
        {
            EditorGUI.BeginChangeCheck();
            _autoConnectOnEnable = EditorGUILayout.Toggle(new GUIContent("Auto Connect On Enable?", "Whether the ClientNetSender automatically connects on enable to the set IP and port."), _autoConnectOnEnable);

            if (EditorGUI.EndChangeCheck())
            {
                BuildScriptPrefs.SetAutoConnectOnEnable(_autoConnectOnEnable);
            }

            if (_autoConnectOnEnable)
            {
                EditorGUI.BeginChangeCheck();
                _useLocal = EditorGUILayout.Toggle(new GUIContent("Connect to Localhost?", "Whether the client should connect to a localhost (127.0.0.1), or another custom IP address."), _useLocal);

                if (EditorGUI.EndChangeCheck())
                {
                    if (_useHetzner && _useLocal)
                    {
                        _useHetzner = false;
                        BuildScriptPrefs.SetUseHetzner(_useHetzner);
                    }

                    BuildScriptPrefs.SetUseLocal(_useLocal);
                }

                EditorGUI.BeginChangeCheck();
                _useHetzner = EditorGUILayout.Toggle(new GUIContent("Connect to Hetzner Server?", "Whether the client should connect to the hetzner remote server (88.198.75.133), or another custom IP address."), _useHetzner);

                if (EditorGUI.EndChangeCheck())
                {
                    if (_useLocal && _useHetzner)
                    {
                        _useLocal = false;
                        BuildScriptPrefs.SetUseLocal(_useLocal);
                    }

                    BuildScriptPrefs.SetUseHetzner(_useHetzner);
                }

                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.LabelField(new GUIContent("Server Address:", "The IP + port address of the server, which the client should connect to."), GUILayout.Width(EditorGUIUtility.labelWidth));

                if (!_useLocal && !_useHetzner)
                {
                    EditorGUI.BeginChangeCheck();
                    _serverIp = EditorGUILayout.TextField(_serverIp);

                    if (EditorGUI.EndChangeCheck())
                    {
                        BuildScriptPrefs.SetServerIP(_serverIp);
                    }
                }
                else if (_useLocal)
                {
                    EditorGUILayout.SelectableLabel(BuildConstants.localhost);
                }
                else if (_useHetzner)
                {
                    EditorGUILayout.SelectableLabel(BuildConstants.hetznerIp);
                }

                EditorGUI.BeginChangeCheck();
                _serverPort = EditorGUILayout.IntField(_serverPort);

                if (EditorGUI.EndChangeCheck())
                {
                    BuildScriptPrefs.SetServerPort(_serverPort);
                }

                EditorGUILayout.EndHorizontal();
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                _serverPort = EditorGUILayout.IntField(new GUIContent("Server Port: ", "The server port to connect to. Should be the same port as on the server ;)"), _serverPort);

                if (EditorGUI.EndChangeCheck())
                {
                    BuildScriptPrefs.SetServerPort(_serverPort);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Build for Client"))
            {
                if (!Directory.Exists(_buildFolder))
                {
                    SetBuildFolder();
                }

                if (_useLocal)
                {
                    if (_buildAndRun)
                    {
                        BuildScripts.BuildAndRunClientLocal(_clientOnlyScene, _buildFolder, _devBuild, _buildTarget, _serverPort, _autoConnectOnEnable);
                    }
                    else
                    {
                        BuildScripts.BuildClientLocal(_clientOnlyScene, _buildFolder, _devBuild, _buildTarget, _serverPort, _autoConnectOnEnable);
                    }
                }
                else if (_useHetzner)
                {
                    if (_buildAndRun)
                    {
                        BuildScripts.BuildAndRunForHetzner(_clientOnlyScene, _buildFolder, _devBuild, _buildTarget, _serverPort, _autoConnectOnEnable);
                    }
                    else
                    {
                        BuildScripts.BuildClientForHetzner(_clientOnlyScene, _buildFolder, _devBuild, _buildTarget, _serverPort, _autoConnectOnEnable);
                    }
                }
                else
                {
                    if (_buildAndRun)
                    {
                        BuildScripts.BuildAndRunClientForIP(_serverIp, _serverPort, _clientOnlyScene, _buildFolder, _devBuild, _buildTarget, _autoConnectOnEnable);
                    }
                    else
                    {
                        BuildScripts.BuildClientForIP(_serverIp, _serverPort, _clientOnlyScene, _buildFolder, _devBuild, _buildTarget, _autoConnectOnEnable);
                    }
                }

                GUIUtility.ExitGUI();
            }

            if (GUILayout.Button("Run as Client"))
            {
                if (_useLocal)
                {
                    BuildScripts.PlayAsClientLocal(_serverPort, _clientOnlyScene, _autoConnectOnEnable);
                }
                else if (_useHetzner)
                {
                    BuildScripts.PlayAsHetzner(_serverPort, _clientOnlyScene, _autoConnectOnEnable);
                }
                else
                {
                    BuildScripts.PlayAsClientForIP(_serverIp, _serverPort, _clientOnlyScene, _autoConnectOnEnable);
                }

                GUIUtility.ExitGUI();
            }

            EditorGUILayout.EndHorizontal();
        }