SaveData.IsRestoringSave() doesnt work

Need help with the editor, or have a suggestion?
Post Reply
ijustlikeprogramming
Posts: 1
Joined: 27 Dec 2023, 04:22

SaveData.IsRestoringSave() doesnt work

Post 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

User avatar
Nuntis
Game Creator
Posts: 32
Joined: 11 Nov 2023, 13:27
Contact:

Re: SaveData.IsRestoringSave() doesnt work

Post 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!

Post Reply