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:
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.
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.