TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ishaq Benaissa
NA
2
606
How to order script execution only if statement apply
Feb 18 2019 12:20 AM
I have two script Loading, and CheckNetwork how do I load the game only if the version of the game match
I would like the script to wait until CheckNetwork finished loading the url and got the result whether the version matched or not.
When the result match, continue loading, else pop up a text then on tap quit the app.
Loading:
private
Image progressBar;
private
void
Start()
{
StartCoroutine(LoadAsyncOperation());
}
IEnumerator LoadAsyncOperation()
{
AsyncOperation gameLevel = SceneManager.LoadSceneAsync(3);
while
(gameLevel.progress < 1)
{
progressBar.fillAmount = gameLevel.progress;
yield
return
new
WaitForEndOfFrame();
}
CheckNetwork
public
string
URL =
""
;
public
string
CurrentVersion;
string
latestVersion;
public
GameObject newVersionAvailable;
private
void
Start()
{
StartCoroutine(LoadTxtData(URL));
}
void
CheckVersion()
{
if
(CurrentVersion != latestVersion)
{
newVersionAvailable.SetActive(
true
);
}
else
{
newVersionAvailable.SetActive(
false
);
}
}
private
IEnumerator LoadTxtData(
string
url)
{
UnityWebRequest www = UnityWebRequest.Get(url);
yield
return
www.SendWebRequest();
latestVersion = www.ToString();
CheckVersion();
}
public
void
OpenURL(
string
url)
{
Application.OpenURL(url);
}
Reply
Answers (
0
)
Getting value from child form to parent form.
form in which store record in table in encrypted form