- Home /
getting the content of a text.doc? (dropbox)
Hey gang, So I made this script in a attempt to see if I can get the content of a text file to see if a user has the current version (hosted on dropbox) though I'm getting a hole bunch of code in my Debug and not just the "1.1" inside the doc? It downloads and stuff but i get a Giant string rather then getting the 1.1, my idea was to check if its the version is not the same thats in the text-doc to prompt the player to a download page for the new version.
using UnityEngine;
using UnityEngine.UI;
public class UpdateGame : MonoBehaviour {
public GameObject PleaseUpdate;
public bool NoUpdateNeed;
IEnumerator Start(){
WWW Update = new WWW ("https://www.dropbox.com/s/99b8zns097lol93/1.1.text?dl=0");
yield return Update;
string update = Update.text;
Debug.Log( ""+ update );
if (update == "1.1") {
PleaseUpdate.SetActive(false);
NoUpdateNeed = true;
} else {
PleaseUpdate.SetActive(true);
NoUpdateNeed = false;
}
}
public void UpdateGameButton(){
Application.OpenURL ("http://www.mysite.com.downloads"); //Download URL for new Version
}
}
Answer by Bunny83 · Oct 24, 2017 at 01:50 AM
Uhm, don't use a "doc" file. A doc file has massive amount of metadata and formatting information included. Use a simple raw format like a txt file. Though in most cases it's more common to use something like json, however if you just want to specify a version string using a text file should work.
Be aware that comparing the string directly might not work if you have a new line or space after your number
edit
I just realised that you used the "download link". You have to either set "?dl=1" at the end or replace it with "?raw=1"
It is a text file, called 1.1 and inside is just 1.1 I'm getting as a string a html thats like a bag e long for some reason rather then just the 1.1 :)
Your answer
Follow this Question
Related Questions
Dropbox check for game version? using WWW? get 1 page debug insted of 0.1? 0 Answers
New to Raycasts, trouble using "hit" 0 Answers
Animator Controller 0 Answers
Not getting debug.log errors from mysql? 0 Answers