Forum rules - please read before posting.

Inventory running local cutscene OR Action List Asset

edited September 2021 in Technical Q&A

Hello!

I have a Inventory item, that when you click on it, it shows a GameObject which is a mini game. The mini game can be used at any time, in any scene.

My question is, should I put the GameObject in each scene ( there are 18 scenes ) or should I instantiate it every time it's used?

I'm fine with either way BUT no matter what I choose, when I use the Standard interactions Use, it's makes me use a Action List Asset, which is in the project and I need to reference things in the scene that I am currently in, such as Camera's, Cutscenes, etc.

What would normally be the best way to do this?

I guess what I'm asking is, can I run a local cutscene Action List compared to an Action List Asset that's in the project?

Thanks!
AC 1.73.2 Unity 2019.4.29F1

Comments

  • As an Inventory item may be interacted with in any scene, it needs to run an ActionList asset file to ensure that it can do so.

    The ActionList asset, however, can still reference objects in the scene - provided that they're present at the time the Actions are run.

    When an Action in an asset file references a scene object, it'll generate a Constant ID value - both in the Action and as a component attached to the object. This ID value acts as a link between the two. You'll need to make sure that this new component is saved.

    If the object is a prefab that ends up being spawned, make sure that Retain in prefab? is checked, so that it's ID value is persistent (if not, it'll generate a new value each time it's spawned).

    I'd recommend having the Inventory Item's ActionList reference as little in the way of scene objects as possible, though - and rely on the scene object itself to handle it's own initialisation Actions. For exampe, your item's ActionList could run an ActionList: Run Action to run an ActionList inside the scene that refers to all the elements in the scene (camera etc) in the usual way.

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.