Forum rules - please read before posting.

How to remember the presence of an object from a different scene

Hello-

In my game, there are 10 different scenes, one of which is sort of the main "hub" from which all of the other scenes branch... sort of like a wide view of the whole room. From that view, players click on different parts/items in the room for closer inspection and further interaction. These hotspots each lead to the other scenes.

Example: there is a table visible in the whole room on which sit 5 jars of liquid. When the player click on the table, the scene switches to a "close up" view of the table; in this scene, the player can remove all of the jars from the table and add them to his inventory. He'll need to navigate back to the whole room to do some other things, eventually using those jars, but just carrying them in the meantime.

When the player goes back to the whole room each time, I would like for those objects he has taken/used/whatever to reflect their presence in each of the individual scenes. How would I do that??

Please tell it to me in very simple and gentle terms, as if I were a 1st grader... because when it comes to all of this, I basically am. 😬

Thanks!

AC v1.77.1
Unity 2021.3.23f1 Personal

Comments

  • To keep track of any changes across scenes, you need to use Global variables - which can be accessed from any scene in the game.

    You've got 5 jars, but start with 1 - the other 4 would be a similar process.

    Create a Global Boolean variable named e.g. "Jars/Jar 1 taken", and leave it's default value as False. It can actually be named whatever you like, but beginning its name with "Jars/" will make it easier to organise - since variable selection lists will then place it inside a sub-folder named "Jars".

    Next, use the Variable: Set Action to set this variable to True when the player takes the first jar.

    Then go back to your "main" scene, and select the jar object in there (the one you want to hide if the player took it in the close-up scene).

    Attach to this AC's Cutscene component. Open up the ActionList Editor for this, and use the Variable: Check Action to check the Boolean variable's value. If it's True, follow it up with an Object: Visibility Action to hide the jar. If it's False, do the opposite and show it.

    You'll then want this Cutscene to run when the scene begins. To do this, attach AC's ActionList Starter component to the same object, and check Run on scene start?.

  • OH MY GOSH!!! This is exactly what I needed, and in straightforward, simple terms, too! Thank you soooo much! This unlocks the final hurdle to being able to finish my first-ever game. 😃

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.