metahunt/Assets/Scripts/Utils/ConnectingPanel.cs
2024-02-11 13:53:18 +05:30

35 lines
707 B
C#

using System.Collections;
using System.Collections.Generic;
using Photon.Pun;
using TMPro;
using UnityEngine;
public class ConnectingPanel : MonoBehaviour
{
public TMP_Text txt;
void Start()
{
if(!PhotonNetwork.IsConnected){
StartCoroutine(SelfDestruct());
}else{
Destroy(gameObject);
}
}
IEnumerator SelfDestruct(){
int j=0;
while(!PhotonNetwork.InLobby){
j++;
txt.text = "Connecting";
for(int i=0; i< j; i++){
txt.text += ".";
}
if(j>5){j=0;}
yield return new WaitForSeconds(0.5f);
}
Destroy(gameObject);
}
}