Forum rules - please read before posting.

Pass Variable Component value to parameter without specifying Game Object?

I am going through the First Person Demo tutorial and I am at the part with the duplication of the drawers. In the tutorial Chris demonstrates using parameters to not have to make a separate behavioral ActionLists for every cloned drawer. However an extra ActionList does have to be created for every drawer in order to point to that afore-mentioned behavioral ActionList and pass it the right parameter data.

I wonder with the inclusion of Variable Components, is it now possible to attach an ActionList with parameters, to a Game Object (like a drawer) and tell it to generically look within itself for a certain named variable. So the drawer mechanism (ActionList) and variable would be self-contained and the working drawer could be cloned an infinate number of times with no overhead to get it working.

Is this possible now?

Comments

  • edited April 2020

    Yes, indeed.

    Move the "ToggleDrawer" (i.e. the ActionList that processes all the parameter logic) to an ActionList Asset file. You can automate this via the ActionList's cog menu in the Inspector.

    Then set your Hotspots' Interaction source fields to Asset File, and refer to this asset directly.

    Then attach a Variables component, and move each "Is open" local variable to its associated Variables component.

    Then attach the Set Interaction Parameters component to the Hotspot, which allows you to set parameter values for a given Interaction within the Inspector. If these assigned values (e.g. GameObject to move, Variable to access) are all part of the object's Hierarchy, you can prefab it and use anywhere.

  • Well that is excellent. It works perfectly. This is one of the most useful features (imo) you have implemented since my last project. It adds buckets of gameplay options which were previously not there. Thanks so much for your hard work.

    Mass spawning awaits!!!

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.