Forum rules - please read before posting.

Interactions and the new Input System

I actually have a few issues. Quick rundown on my project:

  • Unity 2020.2.0b14 with Adventure Creator 1.72.3
  • 2d game with Direct Input (eventually adding option for Point and Click)
  • My hotspot labels are set to never show, and instead I have customized the Interaction menu to include the hotspot label.

----- 1 -----
The most bizarre issue. For some reason my Interaction menu is popping up at the cursor in the middle of the screen (which is locked and hidden) instead of on the hotspot like I have it set:


Is there somewhere else that also influences where the Interaction menu appears?

----- 2 -----
I have the new Input System successfully working thanks to this script and all continuous buttons work well (movement, "hold to run"), but the trigger buttons (InteractionA, InteractionB, etc) only work with the first binding listed. So in the following example, only the PS4 buttons will work, and none of the keyboard buttons work. If I rearrange any of the keyboard buttons to the top of the binding list, they work and the others don't. Is there a way to have it register all of the listed bindings?

----- 3 -----
When I have an interaction that triggers an action list, if the action list is comprised of a single dialog action set to "play in background", the hotspot label is disabled (or destroyed) then re-enabled which causes it to fade back in. I'd rather have it stay constant if all the action list items are "play in background". Is that possible?

Comments

  • Interaction menu

    I assume the image is cropped, and that the top-left corner of it is the centre of the screen?

    If the Menu's Position type is set to On Hotspot, then it should be the Hotspot's centre-point (which can be overridden in the Hotspot's Inspector) that'll determine it's position.

    However, for a Unity UI prefab you must also make sure the "RectTransform boundary" is properly configured - as it's this that AC will take control of to reposition the menu. Check that the Constant ID value listed in the Manager (15198304) matches that on the component attached to your prefab's RectTransform boundary object. This object should be an immediate child of your root Canvas, and a parent of all other objects - so that moving it moves all else.

    Input System

    I shall attempt a recreation, thanks for the report.

    Hospot blinking

    Try setting your Interaction ActionList's When running field to Run In Background. Otherwise, it will still interrupt gameplay, even if only for a single frame.

  • Interaction menu

    Nailed it. The constant ID was the issue.

    I do have my prefab set up correctly, but I'm not sure if this how it's supposed to work:

    When I add my canvas prefab to the "Linked canvas prefab:" box, it doesn't update the ConstantID. It only gets updated when I add it to the "RectTransform boundary:" box. However, then it adds a ConstantID script to the root canvas gameobject and updates the ID to that, which of course doesn't match the ConstantID on the RectTransform child object.

    So what I had to do was delete the ConstantID from the root canvas object and copy the recorded ID from the menu system and manually add it to the RectTransform object.

    Input System

    That would be amazing! Thank you!

    Hotspot blinking

    I totally missed that setting... but... for some reason it's not working for me.

    Here are my settings:

    But it still fades out and in when I perform that interaction.

  • Interaction menu

    Don't assign the root prefab into the "RectTransform boundary" field - that field should be reserved for the root's immediate (and only) child, which AC will reposition as necessary.

    Input system

    I've updated the wiki script to fix this.

    Hotspot blinking

    I'm forgetting myself. As your Menu's "Appear type" is set to "On Interaction", it will turn off once an Interaction is chosen.

    I'll see if this behaviour can be made optional. Can you share your Settings Manager's "Interface settings" for a recreation?

  • Interaction menu

    Ah, now I get it. Thanks!

    Input system

    Works perfectly!

    Hotspot blinking

    Another option I guess would be to set it to appear type "manual" and modify this script so that it looks like this:

    using UnityEngine;
    using AC;
    
    public class InteractionOnNearest : MonoBehaviour {
    
      public float minimumSqrDistance = 10f;
      private Hotspot lastHotspot;
    
      private void Update() {
        if (KickStarter.player != null && KickStarter.player.hotspotDetector != null) {
          Hotspot nearestHotspot = KickStarter.player.hotspotDetector.NearestHotspot;
          if (nearestHotspot != null &&
              KickStarter.stateHandler.IsInGameplay() &&
              (nearestHotspot.transform.position - KickStarter.player.hotspotDetector.transform.position).sqrMagnitude < minimumSqrDistance &&
              nearestHotspot != lastHotspot) {
            lastHotspot = nearestHotspot;
            PlayerMenus.GetMenuWithName("Interaction").TurnOn();
          } else if (nearestHotspot == null) {
            lastHotspot = null;
            PlayerMenus.GetMenuWithName("Interaction").TurnOff();
          }
        }
      }
    }
    

    It works but I have two issues:
    1) It isn't accepting my "Alternate input button:" assignments. I also tried adding EnableUI() and MakeUIInteractive(), as well as KickStarter.playerMenus.EnableInteractionMenus(nearestHotspot) but none of that worked.
    2) Even though I have "Update while fading out?" checked, it still drifts with the camera as it fades out.

    But if you can just make it not blink using the appear type "On Interaction" and "Run In Background" set, that would work for me!

    Here are my interface settings:

  • But if you can just make it not blink using the appear type "On Interaction" and "Run In Background" set, that would work for me!

    I'd say that'd be the best solution. I'll see about making such behaviour optional as part of the next release.

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.