DSIK_project/ShooterDSIK_newbac/Assets/Scripts/GetServerIp.cs

52 lines
852 B
C#
Raw Normal View History

2018-11-29 17:20:24 +01:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using UnityEngine;
using UnityEngine.UI;
public class GetServerIp : MonoBehaviour
{
public Button button;
public InputField input;
public GameObject player;
public GameObject enemy;
IPAddress ip;
public IPAddress GetIP()
{
return ip;
}
private void Start()
{
ip = IPAddress.None;
}
private void Update()
{
try
{
ip = IPAddress.Parse(input.text);
}
catch (Exception e)
{
}
}
public void ButtonPressed()
{
ip = IPAddress.Parse(input.text);
gameObject.SetActive(false);
player.SetActive(true);
enemy.SetActive(true);
}
}