Is there anyway to easily and quickly remove all items from inventory without having to remove each one via separate action lists?
Plus, a quick and easy way to set a scene's variables back to original settings rather than when ending game?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
All items can be removed from the Inventory by calling:
As usual for running custom code, place inside a public C# function and use the Object: Call event Action to trigger the function via a GameObject or prefab its attached to.
The Engine: End game Action has a Reset Scene option, which will reset all saved data associated with the scene. This'll include both local variables, as well as custom Remember data.
To reset only the variables, define a preset in the Variables Manager to set up values to revert to, and use the Variable: Assign preset Action to assign them.
What about local variables (which is the majority of variables I need to reset)
I need to reset all the variables and remember data from a number of scenes, local and global variables. Would be good to have a scene Reset Scene option not just for end game.
Presets are available for Local variables.
Reset Scene will do nothing other than reset the scene data for the active scene - you don't need to use it when your game is ending.
If you want to reset the data for a specific scene, you can call the LevelStorage class's ClearLevelData function:
ok thanks.
And it regards to:
I have a prefab in every scene that has the attached script, as I need to call this through an action list out of scene (dropping item on main player causes death, which needs to therefore empty inventory and reset all variables in certain scenes) - and I cannot currently drop the scene script prefab into the inventory object on to prefab player in play.
A prefab used only to store a script function you want to call does not need to be in the scene. The Object: Call event Action can reference the prefab asset directly.
Thanks!
So I have had some help to create this custom action:
This only works on scenes that are not the current scene. I need the current active scene resetted too but all attempts to do so thus far have failed.
Are you able to help?
If you want to reset the current scene, you can use the regular Engine: End game Action.
But i don't want to end the game, just to restart player at a specific scene and reset certain scenes? Won't restart game put player at the beginning of the game again?
On a certain 'death' I want to empty inventory (i now have a custom action) and reset certain scenes as player will be reborn in scene 3, not scene 1, and i need scenes 3, 4, 5, 6 reset
The Action's Reset Scene method will only do just that - it won't do anything else.
Thanks, but it seems that my script above won’t reset current scene. So if I was to ‘die’ in the scene that you restart in after death (not end game) then that scene will not reset. Anyway to tweak the above script to ensure that happens?
Right i got it nowe, thanks!