- Home /
How do I make my own Remote Settings backend like Unity Analytics Remote Settings?
I was wondering how I would implement creating a file on my server and then being able to change variables in that file to affect my game in real time. I tried using Unity Remote Settings, but it only updates changed variables per session. Right now I use just one text file with 1 number in it and I have this script attached to my enemies at the moment:
private IEnumerator Check()
{
WWW w = new WWW("http://www.*********.com/chance.txt");
yield return w;
LocalChance = Random.Range(0f, 100f);
if (float.TryParse(w.text, out ServerChance) && w.error == null)
{
yield return ServerChance;
if (LocalChance < ServerChance)
{
FishHealth();
_hp = _hp / dividedBy;
if (_hp <= 1)
_hp = 1;
int goldf = System.Convert.ToInt32(_hp);
_gold = goldf * Random.Range(1,4);
}
else
FishHealth();
}
else
{
FishHealth();
}
But If I use this I would have to create a text file on my server for every variable I have. I would really like to keep things nice and tidy and just have one file and have Unity grab the requested variable from that file based on what I'm asking for (similar to how you request a variable with Remote Settings, like RemoteSettings.GetFloat ("blahblahblah"); ). I'd like to make it something like that (MyScript.GetFloat ("blahblahblah"). Then I can later on change my script to update in real time. On top of that I could even add floats, ints, strings, bools, etc. too.
Your answer
Follow this Question
Related Questions
Variables from one script to another. 3 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
summing up items price in runtime 1 Answer