Can't get Interact ability to trigger

tippington

New member
Hello everyone,

I'm trying to create a Crafting Bench object that the player will be able to walk up to and interact with. I've added the Interactable component to it, as well as the Ability Start Location component (which appears to be configured/positioned properly in the Scene Editor. I've also ensured that the Interact ability is present on the player character and wired up to the proper input button/key. Its Object Detection field is set to "Trigger" as noted in the documentation.

Additionally, I've added a script to the Crafting Bench object which conforms to the IInteractableTarget interface:

Code:
using UnityEngine;
using Opsive.UltimateCharacterController.Traits;

public class CraftingBenchBehavior : MonoBehaviour, IInteractableTarget
{
    public bool CanInteract(GameObject obj)
    {
        return true;
    }

    public void Interact(GameObject obj)
    {
        CraftingMenuView.Instance.OnInteract();
    }
}

This script is intended to open a menu via the menu's OnInteract method (just a custom, arbitrarily-named public method I wrote), but I can't seem to get the Interact method to trigger. The character is clearly positioned inside the Ability Start Location range, and I'm certain I'm pressing the right button/key for Action, which is wired up to the Interact ability in the Ultimate Character Locomotion component.

If I have the Ultimate Character Locomotion component visible in the Inspector during runtime, I can see Jump and Fall abilities activating when I jump the character, but Interact doesn't appear to activate in the above scenario.

Is this the proper setup? How can I get the Interact method to execute? Thanks in advance, and let me know if any more information is needed.
 

Attachments

  • Screen Shot 2020-05-20 at 2.52.21 PM.png
    Screen Shot 2020-05-20 at 2.52.21 PM.png
    194.6 KB · Views: 16
  • Screen Shot 2020-05-20 at 2.52.30 PM.png
    Screen Shot 2020-05-20 at 2.52.30 PM.png
    179 KB · Views: 16
Your IInteractableTarget code looks good. To get started have you gotten a new interaction setup using the existing scripts? This should at least help with the workflow:

 
I finally got it to work! Ultimately what seems to have done the trick was:
  • Adding a second, trigger-type box collider to the Interactable object
  • Changing its Interact ID to 1 (although this may have not actually changed anything)
 
Top