Forum rules - please read before posting.

Setting up a 2D Drag and Drop puzzle

edited April 2021 in Technical Q&A

Hello AC community!

First of all, thank you to Chris for providing the Item Arranging Puzzle template in the Downloads. It's been helpful.

Attempting to add a 2D drag and drop puzzle into my game. There are just a couple things keeping it from progressing.

First, my game is using Unity UI for a custom designed "Interaction ring" (meaning basically a ring that contains/shows the appropriate icons for "Use", "Look at", etc. when set up for each hotspot).
So for the "Interaction Method" under "Settings", I've been using "Choose Hotspot then Interaction".
The 2D Item Arranging Puzzle template requires "Context Sensitive".
Is there a way to change the "Interaction Method" to "Context Sensitive" at any point (for example, during certain "puzzle" scenes only?)

At first, I'd assumed there might be a way to change this via an Actionlist, similar to using "Engine: Manage Systems" -- though the "Interaction method" can't be changed in such a way there.

Did read in the "Readme.pdf" in the package that there's a way to set the "Interaction Method" to "Context Only" through script, if needed. If that it the only way, was hoping for a bit of advice in that area, if possible.


Secondly, upon attempting to integrate the drag and drop puzzle into my game, it seemed to go well -- except it shows the "Unhandled Interaction" message each time a draggable object is dropped on any drop hotspot (even the "correct" hotspot). Here's an image showing it.
Unsure why that may be. I've attempted to set it up the same was as the .unitypackage template. In fact, I imported it directly, and followed the instructions under "Creating New Puzzles", as far as I understand.
Perhaps it's to do with the Main Player is being spawned into the scene (whereas initially successfully testing the drag and drop template file by itself in a fresh, separate project didn't appear to include characters)?


Feeling like this is very close.
Current version of AC is 1.73.3, and Unity version is 2021.1.0f1.

Thank you for any assistance that can be provided!
And Happy Easter!

Comments

  • edited April 2021

    Regarding the "Unhandled event", may have come to an understanding on why that was showing.
    When first starting to create the game, I believe I was using "Choose Interaction Then Hotspot" Interaction Method where you first select the interaction type ("Use", "Talk to" etc.) by clicking an icon, and then clicking a hotspot. In this mode the "Unhandled interaction" fields can show -- as it's possible to select an interaction type that isn't supported by a hotspot.

    Since then, I've changed to "Choose Hotspot Then Interaction" which doesn't rely on "Unhandled events" so much.

    So, removed the unhandled event Actionlist that was originally in the "Inventory Manager's" "Global unhandled events", and it doesn't show now.

    Just to supply some more info: The "Unhandled event" showed even if "Context Sensitive" was chosen.

  • edited April 2021

    The 2D Item Arranging Puzzle template requires "Context Sensitive".

    Given recent updates, this may no longer be a requirement - though I'll have to check.

    If you do want/need to change your "Interaction method" at runtime, right-click on the field's label to get an API reference to it. This is the case for any Manager field.

    In the case of the above, it's:

    AC.KickStarter.settingsManager.interactionMethod
    

    These two functions, placed in a new C# script, can be used to switch between CS and CHTI modes:

    public void SetCS ()
    {
        AC.KickStarter.settingsManager.interactionMethod = AC_InteractionMethod.ContextSensitive;
    }
    
    public void SetCHTI ()
    {
        AC.KickStarter.settingsManager.interactionMethod = AC_InteractionMethod.ChooseHotspotThenInteraction;
    }
    

    To call them from an AC ActionList, attach the script to a new GameObject, make it a prefab, and then use the Object: Call event Action to invoke the functions on that prefab.

    Just bear in mind that runtime changes made to Manager fields will survive exiting Play Mode, so you'll need to run a similar Action in your Settings Manager's "ActionList on start game" asset to set the cursor display to Never when the game begins.

    except it shows the "Unhandled Interaction" message each time a draggable object is dropped on any drop hotspot (even the "correct" hotspot)

    I've updated the package - try it now.

  • edited April 2021

    Thank you for the update and information. Also thanks for the info about it not being required to be only "Context Sensitive".
    It appears to work fine.

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.