Hey Chris,
I'm having trouble with a basic puzzle where a key is used to unlock a door. I tried following your tutorial, but it was mainly focused on 3D and I found it confusing. However, I did get a general idea of how to implement it, but I still can't seem to get it to work properly.
My current implementation:
https://prnt.sc/LauXKxYCDuBt
https://prnt.sc/Ske9rTiB431K
https://prnt.sc/CZmpCwU8xnWK
https://prnt.sc/s6Q7sjW371ky
P.S. Poster is the name of the key.
Thank you
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Your ActionList logic doesn't rely on "unlocking" the door with the key exactly - it looks like it's instead a case of the door becoming unlocked automatically once the "Door_poster" Hotspot is interacted with. Is this your intent?
If you want to make a traditional "use key on door" interaction, you need to involve an Inventory interaction in your Door Hotspot. Below the "Use interactions" panel, create a new "Inventory interaction", and assign the "Poster" item to it. This Interaction will then run when the Player uses the Poster on the Door Hotspot - so that's where you'd typically place your Variable: Set Action that affects the "IsOpen" variable.
For a working 2D example, see the "Key and lock" scene in the "Puzzle template: Simple examples" package available on the Downloads page.
Hey Chris,
Thank you for your reply.
I did check the 2D example "Key and lock" but it doesn't have "Inventory interaction"
https://prnt.sc/37R0nywESqPF
You must assign the package's Manager assets before opening the scenes - you can find instructions in the included Readme file.
Thank you for pointing that out. The 2D example "Key and lock" is working now. However, I did everything exactly as the 2D example and still can't use my inventory to open the door.
My updated settings:
https://prnt.sc/rk11MriOWVAJ
https://prnt.sc/jugmWCVAaxho
https://prnt.sc/IA9XyBw6_3I7
What is the exact behaviour you get? Does using the key on the door remove it from the Inventory?
To help debug logic, you can add ActionList: Comment Actions to your ActionLists - text to enter into them will display in the Console when they're run. Is the "Left_Door: Poster" Interaction being run at the correct time?
If not, what are your interface and inventory settings, as set up in the Settings Manager? These settings determine how inventory items are interacted with in the scene.
The behaviour I'm getting is the inventory item is not unlocking the door, as nothing happens when it is used.
https://prnt.sc/jomaWukclKj8
https://prnt.sc/_rwxuCTk9FtG
https://prnt.sc/JNTZ781WLpMs
Is that to say no comment is appearing in the Console after adding the comment Action to the "Left_Door: Poster" Interaction?
If you click on the door without having an item selected, does it run the "Left_Door: Use" Interaction? If not, check that there are no overlapping colliders / other Hotspots that may be being interated with instead.
Is that to say no comment is appearing in the Console after adding the comment Action to the "Left_Door: Poster" Interaction?
No comment is appearing in the Console
https://prnt.sc/ywj9UtlcLwny
If you click on the door without having an item selected, does it run the "Left_Door: Use" Interaction?
Yes, when I click on the door without having an item selected, it does run the "Left_Door: Use" Interaction.
https://prnt.sc/0yQ0-Bn-2qyY
P.S. I disabled the collider but still can't use the inventory item.
Try running the "Left_Door: Poster" interaction manually by selecting the ActionList in the Hierarchy, and clicking Run now at the top of its Inspector.
Does the Console message then appear, and is the door then working as it should when using it normally afterwards?
When clicking the door with the Key item selected, what is the exact behaviour? Does the item remain selected, or become de-selected?
Hey Chris,
Try running the "Left_Door: Poster" interaction manually by selecting the ActionList in the Hierarchy, and clicking Run now at the top of its Inspector.
The "Run" button has been disabled and cannot be clicked. It has been this way since I began developing my game.
https://prnt.sc/RqulezhpLrTM
When clicking the door with the Key item selected, what is the exact behaviour? Does the item remain selected, or become de-selected?
The item remains selected.
Click it at runtime - it won't take effect while in Edit mode.
You can also click "Run now" in the ActionList's Inspector - this is separate to the ActionList Editor window.
I'm unsure why you'd be getting this behaviour. If you'd like to PM me your Managers and scene asset files, I can try to take a look on my end.