IUserSavedData
Introduction
IUserSavedData
is the ISavedData
for the player specific saved data not related to any IEntity
. This is used to store player preferences like their current Avatar
, and also references to the currently active IContent
, and timestamps of the players last active time in each IContent
. Those timestamps are used in combination with the IProjectionService
to calculate generator payout when returning to a specific IContent
or IEventContent
.
Last Activity Time
SetLastActivityTime
is set through the LogLastActiveTimeStateAction
state action. This is called whenever saved data is serialized which generally occurs when: * the application is paused or ended * the stage is advanced * on a timed interval (by default every 5 seconds).
This sets the last active time of the current IContent
(specified by the ContentId
). If the ContentId
is null then no timestamp is saved. GetLastActivityTime
returns the timestamp of the last user activity in the currently active IContent
. This is generally called when an IContent
is loaded.
Note
The isNew
property returns true if this is a new player, and should be used to show FTUE content like intros and tutorials the first time a player enters the game. It is set to false through the NewUserStateAction
action, which should be fired in your IStartup
implementation.
Relationship
IUserSavedData
inherits from ICloudSavedData so that the BeamableSerializer
will save this data as unstructured JSON instead of in the Beamable inventory system. ISavedData
holds most of the base functionality for saving and loading content.