Loading Custom Data
Whether you’ve saved your custom object data using the Simple or Advanced Method, your data will now be loaded and assigned automatically, with no extra effort required on your part!
Let’s consider a Door as an example. After interacting with the Door (interacted = true), you saved the interaction value (remember,interacted
property from Interactables are automatically saved once interacted with). When you load your game, the interacted value will be set to true as expected. However, visually, the door will remain closed. This happens because we need to make a visual change to show that the door has been interacted with. To achieve this, we’ll use the LoadedState()
method from Identifiable
class.
Here, after loading the interacted value, LoadedState()
is called. To visually show that the door is indeed open, we update the door visuals.
This way, you can perform custom behaviours after loading the data of a custom object.
Last updated