Forum rules - please read before posting.

Multiple inventory managers

Alright. So I set up multiple Unity scenes, each scene is a level for the player.

Now I know some of the managers in AC are specific per scene (like the local variable manager), and others are shared across scenes (like the settings manager). I noticed the inventory tab is not scene specific. 

So what I did was create a separate inventory manager per scene to handle the items specific to that level. When I work on my levels, I set the corresponding inventory manager if I switch a level (and some code makes sure the correct inventory manager is loaded for each scene as well when running the game)

I noticed however something really really disturbing!

Sometimes, when I revisit an Actionlist in a level, all the 'Inventory>Check' actions have lost their reference and are now ALL pointing towards the item in slot 0!!

Now I want to stress that this is not the same error as the action not being able to load an item because the wrong inventory manager is set. The correct manager IS set, but the Actionlist just forgot which item it was supposed to select!!

You can imagine this frightens me a great deal, as I don't want to see my actionlists randomly breaking as the game grows. and the keyword here is 'randomly' most actionlists are fine, but sometimes I find one that just... breaks like this.

Help? : / 

Comments

  • Setting the Inventory Manager per-scene is going to bring about all kinds of problems, and should never be done.  Inventory items are scene-independent: if you pick something up, you should be able to carry it from scene to scene.

    The items that you pick up in a scene don't live in the Inventory until you actually carry them: the data you supply in the Inventory Manager has no basis on the scene objects, so any e.g. sprites in the scene you can pick up are technically separate to the items that appear in your Inventory menu.

    Are you trying to limit what items the player can access in a scene once they're in the inventory?  You might be able to do that by assigning a category to each item (with one category per scene).
  • Aha. Well!

    I guess I am happy I discover it now, and not later.

    I know what I will be doing today... haha
  • Here is an interesting thing though:

    If you have 2 inventory items named the same, but with different descriptions and textures, it only shows up once in the options for Inventory > Add actions. 
  • That's a problem with the way Unity groups lists.  The way to get around that would be to name them differently for editor-use, but then write their correct names in the "Label (if not name)" field in the Inventory Manager.
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.