Hi all!
My friend and I are currently working creating a game expanding on the Wikipedia Game. I'm currently working on setting the target page you have to get to in order to win. Luckly, wikipedia has a nifty URL we can use to open up a random page.However, I'm having trouble finding out how to get the url of that page. This is what I have so far:
private void Start()
{
string randomLink = "https://en.wikipedia.org/wiki/Special:Random";
StartCoroutine(getTarget(randomLink));
}
private IEnumerator getTarget(string url)
{
using (UnityWebRequest getTargetURL = UnityWebRequest.Get(url))
{
yield return getTargetURL.SendWebRequest();
if (getTargetURL.isNetworkError || getTargetURL.isHttpError)
{
Debug.LogError(getTargetURL.error);
}
else
{
target = //New URL
}
}
}
Thanks for your time!
↧