Trying to Invoke Void when Void has Stuff in Parameters - Easy Question
This is an easy question and I searched google and could not find something that fitted what I need. The forums say you need a string but I just can't get it to work. This is a dumb question that I cannot figure out. I want to call SaveGame and I have SaveGame(); but I think I need to put something in those parameters but I just don't know. I get the no overload for method 'SaveGame' takes '0' arguments error. Can someone help me out? Thank you in advance.
void signin()
{
SaveGame();
}
void SaveGame (ISavedGameMetadata game, byte[] savedData, TimeSpan totalPlaytime) {
ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
builder = builder
.WithUpdatedPlayedTime(totalPlaytime)
.WithUpdatedDescription("Saved game at " + DateTime.Now);
if (savedImage != null) {
// This assumes that savedImage is an instance of Texture2D
// and that you have already called a function equivalent to
// getScreenshot() to set savedImage
// NOTE: see sample definition of getScreenshot() method below
byte[] pngData = savedImage.EncodeToPNG();
builder = builder.WithUpdatedPngCoverImage(pngData);
}
SavedGameMetadataUpdate updatedMetadata = builder.Build();
savedGameClient.CommitUpdate(game, updatedMetadata, savedData, OnSavedGameWritten);
}
Answer by jgodfrey · Mar 11, 2016 at 02:20 AM
Well, the SaveGame() function is defined in the script you posted. There, you can see the signature looks like this:
void SaveGame (ISavedGameMetadata game, byte[] savedData, TimeSpan totalPlaytime) {...}
In order to call it, you need to pass in 3 arguments of the following types:
An ISavedGameMetadata object
A byte array
A TimeSpan object
So, no, you can't call it simply using "SaveGame()"...