Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.IO;
- public class imgdownloader : MonoBehaviour {
- public string url = "https://api.nasa.gov/planetary/apod?api_key=a9gKbyf2cWMGOrHRen6J1C414DpQcjOhFsPTlUVF";
- public string data = "hejka:*";
- public string odpowiedzJson;
- public bool PobierzDane = false;
- [HideInInspector]
- public bool pobrano = false;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if (PobierzDane)
- {
- PobierzDane = false;
- StartCoroutine(Loadimage ());
- }
- string chujdupa;
- Debug.Log(chujdupa);
- Debug.Log(string.Format hejjj)
- }
- https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?earth_date=2015-6-3&api_key=DEMO_KEY
- void OnGUI()
- {
- // Make a text field that modifies stringToEdit.
- data = GUI.TextField(new Rect(100, 100, 50, 20), data, 25);
- Debug.Log(string.Format("https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?earth_date={0}&api_key=DEMO_KEY&fbclid=IwAR18f8tfBH1Qn2RQpY81y5QG_WN6K9T69xfSZ7UU_WT3kZC9VMUam3STlkQ", data));
- }
- public IEnumerator Loadimage()
- {
- pobrano = false;
- WWW readingsite = new WWW(url);
- yield return readingsite;
- if (string.IsNullOrEmpty(readingsite.error))
- {
- odpowiedzJson = readingsite.text;
- Debug.Log(odpowiedzJson);
- pobrano = true;
- }
- else
- {
- odpowiedzJson = " ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement