Forum rules - please read before posting.

Trying to make duplicable lamps (actionlist parameters, IDs...)

Hi there.

In my latest tests with AC I've been trying to make a lamp that can be activated with a hotspot interaction, and no problem there. I made one by having an ActionList replace the bulb mesh with an emmisive one, and move a point light from out of bounds to on top of the bulb, and then replacing the hotspot with one that will reverse those actions.
That means that:
-A mesh
-A light
-Two hotspots
...are being referenced in the ActionList.
The lamp effectively works.

But I've also been trying to make it into a duplicable prefab, so that I can just drop several of those lamps, and they would work independently from each other. This doesn't work by default, naturally, because of how the objects and lights are referenced, so I tried looking into IDs and ActionList parameters, but I still have trouble wrapping my head around it.
Could I get a tip or explanation on how to make that work? (If that's even possible)

Here are some screenshots, just in case:

(In-scene interaction to turn on)

(In-scene interaction to turn off)

(video of that in-scene lamp working as intended)

(attempt at making an ActionList with parameters)

(the ActionList that would run the one with parameters)

Other info:

Unity 2021.3.11f1 (LTS)
AC 1.78.1 (a few versions behind it seems)

Comments

  • Looks like you're on the right track. You don't need to use an ActionList: Run Action to run the Interaction and set the parameters, however - you can incorporate the parameter values into the prefab itself.

    Your ActionList with parameters can be assigned to the Hotspot directly by setting the Hotspot's Interaction source field to Asset File. Then, attach the Set Interaction Parameters component to it. That will let you assign each of the objects in the prefab's Hierarchy to the parameters for a given Use interaction.

    You might want to simplify the number of Actions / objects involved, however. Rather than having separate Hotspots, you can just use one - either with two separate Interactions (enabled/disabled with Hotspot: Change interaction), or just have one Interaction that uses a Component variable to keep track of its on/off state.

    If you wanted to go further, you could also rely on Animation to control your meshes / light values together - so turning a light off would then just be a case of using the Object: Animate Action to play back the "off" animation.

    These concepts are covered in more detail in the "Logic prefabs" tutorial video you can find here.

  • Thank you for the tips. Your first two paragraphs were enough for it to work as intended.

    I agree that it could be simplified, it was just the most straightforward thing I could think of at the time, without adding animators and animations and stuff. But it's certainly something to keep in mind. I'll also check out the Logic Prefabs tutorial.

    Thanks for the help.

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.