Quantcast
Channel: Questions in topic: "httpwebrequest"
Viewing all articles
Browse latest Browse all 190

POST JSON method does not work when project has been exported to WEBGL and upload to firebase,help please?

$
0
0
I have a database set up on firebase and when i run my game in the unity edtitor and as a standalone exported Windows .exe file, the call gets made correctly to the database and JSON data gets posted correctly. However when I export the exact same project to WEBGL and upload it to my firebase hosting server, the JSON call does not work. Here is my code, could someone please help? using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; public class GameOverMenu : MonoBehaviour { public InputField nameInputField; public void MainMenu() { SceneManager.LoadScene("Menu"); } public void SubmitScore() { StartCoroutine(SendScore()); SceneManager.LoadScene("Menu"); } // Use this for initialization void Start() { } // Update is called once per frame void Update() { } public IEnumerator SendScore() { Scoreboard s = new Scoreboard(nameInputField.text, PlayerPrefs.GetInt("Score"), PlayerPrefs.GetInt("Seed")); Dictionary headers = new Dictionary(); headers.Add("Content-Type", "application/json"); Hashtable data = new Hashtable(); data.Add("name", s.Name); data.Add("score", s.Score); data.Add("seed", s.Seed); UnityHTTP.Request postRequest = new UnityHTTP.Request("post", "https://alexclearythesisgame.firebaseio.com/Scoreboard.json", data); postRequest.Send(); yield return postRequest.isDone; } }

Viewing all articles
Browse latest Browse all 190

Trending Articles



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