- Home /
C# How can I get unity game to not go past title screen if there is no internet connection on iOS device
I have a title screen in my game as scene 1. If there is no internet connection on their iOS device when they start it I want them to not be able to press anything onscreen and a panel to show saying “ this game requires internet connection”. Program in C#.
Create an intermediate scene between title and game scene and check internet connection with a scprit in there. If there is no connection don't load game scene:
public class ChechkConnection : $$anonymous$$onobehaviour{
if(Application.internetReachability == NetworkReachability.NotReachable)
{
//you could display your warning in UI here
} else {
Scene$$anonymous$$anager.LoadScene("your actual game scene");
}
}
Answer by dargonknight · Mar 20, 2019 at 11:31 AM
@SeanWink the easiest/best approach is to do the following: in ur title scene you usual load the game scene right? instead of directly doing so do the following:
1-create an panel on UI ( canvas) that holds your text message.
2-show that panel if there is no internet connection.
//in the top of ur class as a public variable that u insert through editor
public GameObject noInternetPanel;
//inside ur function insread of ur scene load code
if(Application.internetReachability == NetworkReachability.NotReachable)
{
noInternetPanel.SetActive(true);
}
else
{
//scene related code if exist
SceneManager.LoadScene("your scene");
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Detect RAM usage of program 0 Answers
My already released iOS app only shows Unity placeholder ads :( 1 Answer
[Solved] What is the best way to document your code on a mac? 1 Answer