Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

How to make a high score file for webGL?

$
0
0
hello, i have made a simple mini-game with a high score system in it. i have built it for web gl and put it up on my website but it doesn't seem to save the high score file to the server. could you tell me where it might be saving and how to make it save to a file on the server so people can see others high score? here is the code: using UnityEngine; using System.Collections; using System; using System.Runtime.Serialization.Formatters.Binary; using System.IO; ... ... ... public void Save_Score(){ BinaryFormatter bf = new BinaryFormatter (); FileStream file = File.Create ("Score.dat"); PlayerData data = new PlayerData (); data.High_Score = High_Score; bf.Serialize (file, data); file.Close(); } public void Load_Score(){ if (File.Exists ("Score.dat")) { BinaryFormatter bf = new BinaryFormatter (); FileStream file = File.Open("Score.dat" , FileMode.Open); PlayerData data = (PlayerData)bf.Deserialize(file); file.Close(); High_Score = data.High_Score; } } } [Serializable] class PlayerData { public int High_Score; }

Viewing all articles
Browse latest Browse all 2390

Trending Articles



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