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

Multiple instances of Prefab with asset file actionlists needing to animate specific in scene object

In our game, we have a prefab that we want to be able to place in separate scenes. It has interactions for a large variety of inventory items, so we used asset file interactions in our hotspot to be able to reuse them through the game. We are having issues trying to tell specific instances of our prefab's animator to do an animation.

At a part in the actionlist we want the object, when inventory interaction has happened, to be animated. We have a bool and a trigger that we would like to talk to. We also would have a few instances of this prefab in the same scene, so with it being a prefab, we can not animate the controller selected in assets because it would tell all of the controllers to animate, and we want the specific one the interaction happened on to animate.

I searched around for a solution, and I have a few ideas for ways to achieve this, but none of them seemed very clean or proven to work yet, and I wanted to see if there was a way that AC asset file actionlists could find the object or hotspot in scene that triggered it, and send a message back, or just any other nice way to let us be able to animate a specific in scene object with asset file actionlists.

Comments

  • Welcome to the community, @gooby_c.

    This is best done via ActionList parameters, which allow you to modify an ActionList's fields at runtime.

    Hotspot interactions are a special case, because if your interaction ActionList includes a GameObject parameter, you can optionally set that parameter's value to the clicked Hotspot automatically. You should therefore be able to have this parameter override the Animator field in the Object: Animate Action.

  • Thanks @ChrisIceBox , this definitely feels like what I needed to read to be able to get closer to solving things.

    I may be misunderstanding, I have read that page a few times now, and am looking at things in game, but I think I am still missing a piece.

    This post from another user's question seems very close to the same thing, except we were trying to avoid custom scripts, but it may be necessary.

    Is there anyway to solve the problem they had without having a custom script?

  • Your problem, as I understand it, shouldn't involve custom scripting. Like I said, it should be automatic provided you configure the Hotspot Inspector correctly.

    Which version of AC are you using? Once you've defined a GameObject parameter in your ActionList, a Hotspot parameter field should appear in its associated Interaction panel. I don't know what progress you've made on this, so any screenshots you can share may help to understand the issue.

  • @ChrisIceBox

    The configure the Hotspot part is what made me rethink and get things working. I realized that I needed to have the hotspot on the same GameObject as the Animator that I was trying to pass the parameter from.

    I had a child object for the hotspot initially that was calling on the ActionList, and wasn't aware that I was telling the ActionList what parameter to set it as from the Hotspot interaction.

    I moved the hotspot interactions and collider onto the same object as the animator, and things behaved as they should.

    Thank you very much for the help. I am with Madorium, LLC. We are working on The Puppet of Tersa and your tool is absolutely amazing and your support to everyone using your tool is outstanding. Thank you thank you.

  • Happy to help, @gooby_c. Reviews are always welcome.

    Indeed - the parameter is set to the same GameObject that the Hotspot component is placed on. That can be modified, however, with a simple script - since the OnBeginActionList custom event can be used to modify an ActionLists' parameters before the list is run.

    If you'd prefer to leave the Animator on a child, try this - placed once as a component in your scene:

    http://pasteall.org/1409011/csharp

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.