I have 3 separate code that requires me to change the ip address manually whenever I am testing outside. therefore I am trying to enter an inputfield in unity so that I can enter it once and it will be used by all my code but I have no idea how to do it.
This is just a simple input field that I have placed in my Homepage.cs page to enter the ip address
using UnityEngine;
using UnityEngine.UI;
public class HomePage : MonoBehaviour
{
public Text playerDisplay;
public InputField ipField;
public Button submitButton;
private void Start()
{
if (DBManager.LoggedIn)
{
playerDisplay.text = "Player: " + DBManager.username;
}
}
public void QuitGame()
{
Debug.Log("Quit!");
Application.Quit();
}
}
This is my Homepage code that I just put the InputField 'ipField' only. The input from here I would like to transfer it to
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class Registration : MonoBehaviour
{
public InputField nameField;
public InputField passwordField;
public Text error1 = null;
public Text error2 = null;
public Button submitButton;
readonly string postUrl = "http://localhost/sqlconnect/register.php";
my Registration.cs page. This is just a part of the code, I only put the relevant part. What I want to replace is the 'localhost' from the readonly string to the inputfield from my Homepage.cs page. Is there a solution to this?