Then, we need to flesh out that ServerResponse function that Initiate was supposed to call. Here’s an example of this:
public void ServerResponse (string jsonData){ServerData data = JsonMapper.ToObject<ServerData>(jsonData);this.setAuthentication(data.authentication);this.setExistence(data.existence);this.setOfflinePlay(data.offlinePlay);this.setHostname(data.hostname);}
Now we have all of the necessary information! With this information, we can bypass the login screen. We can warn a player about overwriting data without making an addition call to check save data existence. We can hide our offline play button. We can tell our app where to go to get the game specific data.
And that’s it! You have a basis for integrating your Unity app into your website. Of course, there’s more going on in our production scripts. Features of our web script that aren’t mentioned above are logging in through the game, sending save data to the server, loading data from the server, and several other small helper functions that are especially useful for providing a clear and functional GUI.
If you have any questions about the things I discussed above, please leave a comment! I would be happy to help. Suggestions are also welcomed – developing is a constant learning process. Thank you for reading.
