Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

what is this "get_isActiveAndEnabled can only be called from the main thread....." Please help??

$
0
0
why unity shows this message? get_isActiveAndEnabled can only be called from the main thread.Constructors and field initializers will be executed from the loading thread when loading a scene.Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function. UnityEngine.UI.Text:set_text(String)loader:DownloadFileCompleted(Object, AsyncCompletedEventArgs) (at Assets/loader.cs:29)System.Net.WebClient:m__E(Object) Please help? using UnityEngine; using System; using UnityEngine.UI; using System.Net; public class loader : MonoBehaviour { public Text mesaj; public string filename,filename2; public void dosyaoku() { WebClient client = new WebClient(); client.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(DownloadFileCompleted); filename2 = Application.dataPath + "/" + "FiyatListesi.csv"; client.DownloadFileAsync(new Uri("https://docs.google.com/spreadsheets/d/mysheetid/export?format=csv&id="mysheetid&gid=gidnumber"), filename2); } void DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { if (e.Error == null) { AllDone(); } else { mesaj.text = e.Error.Message; } } private void AllDone() { mesaj.text = "file downloaded"; } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>