Forum rules - please read before posting.

I feel like I'm misunderstanding hot spot/action list usage in prefabs...

This post is in response to me playing around with setting up prefabs, reading documentation, and this article: https://adventurecreator.org/tutorials/introduction-parameters

The problem I'm having, is it seems like in the end, there's no foolproof way to set up a prefab to the point where you could drag and drop them into a scene and have them work, depending on the setup of the action lists. In the article I referenced above, you would still always be stuck dragging game object references into the interaction of the hotspot so the ActionListAsset has the needed references. You'd also have to set the inventory item type each time in that example.

So where am I going wrong in my understanding?  Typically prefabs are supposed to be there so you can completely configure objects, drop them into a scene, duplicate within the scene, and everything works fine in any of those use cases. I feel like it's really hard to fully set up self contained prefabs where interactions are properly set up and contained in the prefab.

Comments

  • So, if I set up a hotspot for an object which has an in scene interaction and that interaction needs to destroy or hide that object when we interact, there's no way to conveniently duplicated that object numerous times and have it reference the appropriately duplicated object for destruction (As far as I can tell on each duplication you'd have to drag the duplicate game object into the action list where the object is destroyed)?  Or similar cases? 

    I don't really want scene only objects of course, but it seems no matter how you slice it, you can't just have "carefree" prefabs with AC?  To clarify, I'm looking at a simple case where I can setup something like an ammo item pickup where there are dozens or even hundreds, and the most I have to do is simply drag the prefab from the project view into the scene, and then duplicate/position to my hearts content.
  • edited August 2018
    Another confusion, is when I am using Asset file based action lists, and I tell an interaction it's using an asset file, when I drag the asset file which contains parameters it uses to execute functionality, there's no way to set the parameters aside from one which is named "Hotspot Parameter".  Id expect to be able to set all of the parameters here. And what is that "Hotspot parameter" for?

    This is version 1.64.5.

    https://www.adventurecreator.org/forum/discussion/5535/prefab-interactions

    That post seems to allude to the ability to set all parameters in the interaction which references an asset file based action list.
  • So apparently for this to actually work you have to have a separate interaction component set to use an asset file rather than rely on the Hotspot with it's interaction source set to Asset File?  Is this intentional or a bug?  If I try to set the asset file directly as an Interaction inside of the Use Interactions region of a hotspot, it won't allow me to set the parameters? That is massively counter intuitive. Let me know if I'm off base here.
  • edited August 2018
    Ok, that's still inadequate as the Interaction component I've added doesn't retain the proper Constant ID assigned to the root object I want to destroy in the prefab on pickup... grr

    So am I expected to manually assign the CID after making it into a prefab?  I'm so bloody confused. 

    .. nope manually assigning doesn't actually recover the reference after dragging and dropping it into the scene...
  • I think it's best to back up a little and start from the beginning - what is it exactly you're trying to do?  You mention picking up ammo boxes, but I'll need more detail to understand what it is exactly you're expecting.  Ignoring the methodology for the moment, please explain the situation you're looking to achieve as clearly as you can, and I'll try to advise on the best solution.

    Manually assigning CID numbers is generally not necessary, but understand that if "Retain in prefab?" is checked on the prefab's Constant ID itself, then the ID will be the same for the first instance within the scene.  Otherwise, or as with other instances, the ID number will be different - and the local instance needs to be assigned in the field if you want it to be "found" by the ActionList.

    The discussion you linked to was from a while ago, and was only referring to the ability to set parameter values within asset files.  The "Hotspot parameter" field is a way of automatically setting a "GameObject" parameter's value to the Hotspot that an Interaction is triggered from.  The complexity of the ActionList: Set parameter Action makes it problematic to place within the Hotspot Inspector itself, hence that is limited to the automatic "Hotspot parameter" field.  However, other values can be assigned via custom script, and I can assist with that if necessary.

    Be aware, however, that destroying multiple instances of a shared prefab is made more complex because of the need to have them spawn back upon loading a save game made beforehand.  I would certainly recommend considering simply moving items out of view when "picked up" as opposed to destroying them - at least while your ID issues are being sorted out - as these only add to the complexity of the situation.
  • One issue I did turn up when investigating this: if a GameObject has multiple "Remember" components on it (this includes the base "Constant ID" component), then their ID numbers won't be correctly re-generated if duplicates are found.

    I shall address this as part of the next update, but in the meantime you can work around this by only having a single Remember/ConstantID component on any prefab you're placing multiple instances of down in the scene.
  • Wow man, you're thorough.  Cheers.
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.