Page 1 of 1

SaveData.IsRestoringSave() doesnt work

Posted: 27 Dec 2023, 04:46
by ijustlikeprogramming

SaveData.IsRestoringSave() doesnt work (or at least the documentation on it is wrong), the error currently produced is shown below
Image
Not really much else I can say, I got this error from a blank project with just the Core Module and this loaded to test if it works
Image


Re: SaveData.IsRestoringSave() doesnt work

Posted: 27 Dec 2023, 10:28
by Nuntis

Oops, that looks to be a silly typo on my part. Try 'IsRestoringGame' instead of 'IsRestoringSave'. I'll correct the docs website in a moment.

It's also worth noting that if you call this function from within the main body of a Script asset, it will always return true, because at the time a Script asset runs, save data is technically being loaded (even when starting a new game). So the best place to use this is either in a named function, or in a State node's Actions Taken script, or perhaps in a Choice node's Appears When script.

If you'd just like to check whether the function exists (could perhaps be useful at some point for checking if a certain engine feature is present), then try removing the parentheses, so the function isn't called but you implicitly cast it to a boolean instead.

Sorry for the trouble!