Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

resetting component variables in a scene

Hello

I wanted to ask is there an action list that lets you reset all component variables in a level/scene in unity to the setting you initially set them in the editor. I noticed an issue that when I exit to the main menu and return to a level any changes to variables are still set (e.g. boolean is still set to true when returning to level when it should be false at the start.)

One way I could fix this is to manually set all the variables in the during the opening cutscene to what I want but that is a bit of a time-consuming process I was wondering if there could be a quicker way.

Comments

  • edited February 26

    Typically this is the behaviour you'd want - changes made to a Variables component should be persistent for the game, just as with any other e.g. Local variable.

    You can prevent this from happening, however, by removing its Remember Variables component - which is what's actually recording the values.

    To reset all changes saved (including the player's inventory, etc), you can use the Engine: End game Action to restart the game and go back to the Menu screen that way.

  • thats good to know, I am making a smallish game and pretty much everything happens in just 1 scene/level so I don't need it to remember variables for each level when the player completes it

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!