I created a lock puzzle using an AC menu, with the source set to AC. The puzzle works fine when I enter the 5-digit combination code.
However, there's one small issue pressing up or down (Vertical input) doesn't change the numbers. Only E works for cycling through the numbers. I'm using Cycle for these numbers.
Any idea how to enable Vertical input so that I can change the numbers using Up and Down?
https://prnt.sc/KfxQ1WTJMJlj
https://prnt.sc/2d-eUOYT67oZ
https://prnt.sc/IRG6SUvYTnfS
https://prnt.sc/DIBNSfoobx0s
Global vars: https://prnt.sc/MBAVb8Clg6dl
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Tricky. You might be able to do it by altering the expected input when the dials are selected. Something like this:
Where should I attach this script, Chris?
An empty GameObject in the scene.
Thank you, Chris. It worked. Here's the final script:
using UnityEngine;
using AC;
public class DialInputs : MonoBehaviour
{
void Start()
{
}
How can I make the puzzle menu close using the "Esc" key without creating a "Cancel" button in the menu?
I tried creating a "Cancel" button with no text to make it invisible, but it interferes with my Up and Down inputs—every time I press Up, the cancel button gets highlighted.
https://prnt.sc/DogLiW36BZiB
Use Active Inputs to run ActionList logic when an input is pressed.
I've created an Active Input that runs an ActionList, but I still can't close the puzzle menu using the Esc key. Am I missing something?
https://prnt.sc/nb1Wgod7XBfE
https://prnt.sc/uZa7qRqyhZ9P
I managed to fix the problem by changing the Active Input to trigger when the game is both Normal and Paused. However, I discovered a bug related to the script you provided. When the script is active, and I cancel the puzzle menu, all hotspots in the scene become inactive—nothing happens when I interact with them.
using UnityEngine;
using AC;
public class DialInputs : MonoBehaviour
{
void Start()
{
}
bool CustomInputGetButtonDown(string input)
{
var element = KickStarter.playerMenus.MouseOverMenuElement;
if (element != null && element.title.StartsWith("Dial"))
{
if (input == "InteractionA") return Input.GetButtonDown("Vertical");
if (input == "InteractionB") return Input.GetButtonDown("Vertical");
}
try
{
return Input.GetButtonDown(input);
}
catch
{
return false;
}
}
The script must only be active while the puzzle is active. If you close the puzzle menu, de-activate the script.
I tried deactivating the script using this approach, but it didn't work:
In the puzzle menu, I used the following actions:
On menu turn on: Object: Add to add the prefab.
On menu turn off: Object: Remove to remove the prefab.
I also attached the Remember Transfer component to the prefab.
Despite this setup, the issue still persists. Any idea what might be going wrong?
Try adding the following to the script:
Thank you, Chris. Unfortunately, this didn't work. I tried other methods as well, but none of them were successful.
On top of that, I discovered another issue—when I press the "Down" key, the dial numbers go up instead of backward, just like the "Up" key.
Your modified script causes it to have no difference in reaction when pressing InteractionA or InteractionB - revert to the original script I provided.
If the overriding should only occur while a given Menu is open, replace:
with:
Where "Lock" is replaced with the name if your Menu.
Thank you, Chris. When I use your original script I always get this error:
error CS0111: Type 'DialInputs' already defines a member called 'InputGetButtonDown' with the same parameter types
Replace the Start function with the edited one in my first post.
Great, thank you, Chris! I can confirm that the script is now deactivated after closing the puzzle menu.
However, I have two minor issues that I hope you can help me fix:
My current Unity inputs:
https://prnt.sc/M4Xv4UKGmJii
https://prnt.sc/6kqCREumKW_P
https://prnt.sc/3976hBVuBlKF
My final script:
https://prnt.sc/Kq6_cHlch4JY
Check Right-click cycles back? in the Cycle element, and swap the Up/Down inputs in the script.
Worked 100%—I really appreciate your help, Chris! I can confirm that the puzzle is now working as intended.
Final working script for reference:
using UnityEngine;
using AC;
public class DialInputs : MonoBehaviour
{
}
Hey Chris, I created another lock puzzle that's exactly the same as the previous one, with some changes to the artwork. However, when I reused the same script and just updated the menu name, I started getting errors. Any idea how to fix them?
https://prnt.sc/WT_2ioUAPGGj
Script:
using UnityEngine;
using AC;
public class DialInputs : MonoBehaviour
{
}