today all out of the sudden this error came. i was doing some basic stuff what i did before and this error apeared. i was making a stocks shower for my custom dashboard and it works but and could not find a problem in my script. i hope you guys can help me. thanks in advance. NOTE: im using Unity 5.6.0b3
using UnityEngine;
using UnityEngine.UI;
using System.Xml;
using System.Collections;
public class Stocks : MonoBehaviour {
string AEXurl;
string Microsofturl; string Appleurl; string Googleurl;
string Intelurl; string Nvidiaurl; string AMDurl;
string EAurl; string Blizzardurl; string Ubisofturl;
WWW wwwAEX;
WWW wwwMicrosoft; WWW wwwApple; WWW wwwGoogle;
WWW wwwIntel; WWW wwwNvidia; WWW wwwAMD;
WWW wwwEA; WWW wwwBlizzard; WWW wwwUbisoft;
Animation anim;
GameObject Stocks1; GameObject Stocks2; GameObject Stocks3;
Text Stocks1Name; Text Stocks1Price; Text Stocks1Change;
Text Stocks2Name; Text Stocks2Price; Text Stocks2Change;
Text Stocks3Name; Text Stocks3Price; Text Stocks3Change;
void Start () {
AEXurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22%5EAEX%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Microsofturl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22MSFT%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Appleurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AAPL%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Googleurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22GOOGL%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Intelurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22INTC%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Nvidiaurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22NVDA%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
AMDurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AMD%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
EAurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22EA%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Blizzardurl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22ATVI%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
Ubisofturl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22UEN.F%22)&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
anim = GameObject.Find("Stocks").GetComponent<Animation>();
Stocks1 = GameObject.Find("Stocks1");
Stocks2 = GameObject.Find("Stocks2");
Stocks3 = GameObject.Find("Stocks3");
Stocks1Name = GameObject.Find("Stocks1Name").GetComponent<Text>();
Stocks1Price = GameObject.Find("Stocks1Price").GetComponent<Text>();
Stocks1Change = GameObject.Find("Stocks1Change").GetComponent<Text>();
Stocks2Name = GameObject.Find("Stocks2Name").GetComponent<Text>();
Stocks2Price = GameObject.Find("Stocks1Price").GetComponent<Text>();
Stocks2Change = GameObject.Find("Stocks1Change").GetComponent<Text>();
Stocks3Name = GameObject.Find("Stocks3Name").GetComponent<Text>();
Stocks3Price = GameObject.Find("Stocks1Price").GetComponent<Text>();
Stocks3Change = GameObject.Find("Stocks1Change").GetComponent<Text>();
StartCoroutine("Round1");
}
IEnumerator Round1() {
wwwAEX = new WWW(AEXurl);
yield return wwwAEX;
XmlDocument xmlAEX = new XmlDocument(); xmlAEX.LoadXml(wwwAEX.text);
if (wwwAEX.error == null) {
Stocks1Name.text = "AEX";
Stocks1Price.text = xmlAEX.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks1Change.text = xmlAEX.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlAEX.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks2.SetActive(false);
Stocks3.SetActive(false);
anim.Play("StocksUp");
yield return new WaitForSeconds(10);
anim.Play("StocksDown");
StartCoroutine("Round2");
}
else { print("Error Round1"); }
}
IEnumerator Round2() {
wwwMicrosoft = new WWW(Microsofturl); wwwApple = new WWW(Appleurl); wwwGoogle = new WWW(Googleurl);
yield return wwwMicrosoft; yield return wwwApple; yield return wwwGoogle;
XmlDocument xmlMicrosoft = new XmlDocument(); xmlMicrosoft.LoadXml(wwwMicrosoft.text);
XmlDocument xmlApple = new XmlDocument(); xmlApple.LoadXml(wwwApple.text);
XmlDocument xmlGoogle = new XmlDocument(); xmlGoogle.LoadXml(wwwGoogle.text);
if (wwwMicrosoft.error == null && wwwApple.error == null && wwwGoogle.error == null) {
Stocks1Name.text = "Microsoft";
Stocks1Price.text = xmlMicrosoft.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks1Change.text = xmlMicrosoft.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlMicrosoft.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks2Name.text = "Apple";
Stocks2Price.text = xmlApple.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks2Change.text = xmlApple.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlApple.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks3Name.text = "Google";
Stocks3Price.text = xmlGoogle.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks3Change.text = xmlGoogle.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlGoogle.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks2.SetActive(true);
Stocks3.SetActive(true);
anim.Play("StocksUp");
yield return new WaitForSeconds(10);
anim.Play("StocksDown");
StartCoroutine("Round3");
}
else { print("Error Round2"); }
}
IEnumerator Round3() {
wwwIntel = new WWW(Intelurl); wwwNvidia = new WWW(Nvidiaurl); wwwAMD = new WWW(AMDurl);
yield return wwwIntel; yield return wwwNvidia; yield return wwwAMD;
XmlDocument xmlIntel = new XmlDocument(); xmlIntel.LoadXml(wwwIntel.text);
XmlDocument xmlNvidia = new XmlDocument(); xmlNvidia.LoadXml(wwwNvidia.text);
XmlDocument xmlAMD = new XmlDocument(); xmlAMD.LoadXml(wwwAMD.text);
if (wwwIntel.error == null && wwwNvidia.error == null && wwwAMD.error == null) {
Stocks1Name.text = "Intel";
Stocks1Price.text = xmlIntel.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks1Change.text = xmlIntel.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlIntel.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks2Name.text = "Nvidia";
Stocks2Price.text = xmlNvidia.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks2Change.text = xmlNvidia.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlNvidia.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks3Name.text = "AMD";
Stocks3Price.text = xmlAMD.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks3Change.text = xmlAMD.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlAMD.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
anim.Play("StocksUp");
yield return new WaitForSeconds(10);
anim.Play("StocksDown");
StartCoroutine("Round4");
}
else { print("Error Round3"); }
}
IEnumerator Round4() {
wwwEA = new WWW(EAurl); wwwBlizzard = new WWW(Blizzardurl); wwwUbisoft = new WWW(Ubisofturl);
yield return wwwEA; yield return wwwBlizzard; yield return wwwUbisoft;
XmlDocument xmlEA = new XmlDocument(); xmlEA.LoadXml(wwwEA.text);
XmlDocument xmlBlizzard = new XmlDocument(); xmlBlizzard.LoadXml(wwwBlizzard.text);
XmlDocument xmlUbisoft = new XmlDocument(); xmlUbisoft.LoadXml(wwwUbisoft.text);
if (wwwEA.error == null && wwwBlizzard.error == null && wwwUbisoft.error == null) {
Stocks1Name.text = "EA";
Stocks1Price.text = xmlEA.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks1Change.text = xmlEA.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlEA.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks2Name.text = "Blizzard";
Stocks2Price.text = xmlBlizzard.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks2Change.text = xmlBlizzard.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlBlizzard.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
Stocks3Name.text = "Ubisoft";
Stocks3Price.text = xmlUbisoft.SelectSingleNode("query/results/quote/LastTradePriceOnly").InnerText;
Stocks3Change.text = xmlUbisoft.SelectSingleNode("query/results/quote/Change").InnerText + " (" +
xmlUbisoft.SelectSingleNode("query/results/quote/ChangeinPercent").InnerText + ")";
anim.Play("StocksUp");
yield return new WaitForSeconds(10);
anim.Play("StocksDown");
StartCoroutine("Round1");
}
else { print("Error Round4"); }
}
}