Item Pickup using Pickup Ability

nathanj

Active member
Hello again,

I'm rying to customise Item Pickups with a button press with UCC/UIS.

I have the item pick up, when a button is pressed, working but the issue I am having is with the UI displaying the item info. I have added the PickupCanvas component to my pickup item and connected that to the InventoryItemVisualizer. It works but it is always on and I would only like the UI to display when the Pickup raycast is hitting the object.

Is there a way to do this out of the box, or should I make a custom Pickup Ability that enables the pickup item canvas when the raycast detects the object?

Thanks again,
Nathan
 
Hey,

I have a custom Pickup that uses/wrangles the ValidateObject, CanStartAbility and TriggerExit to determine when an objeect is being focused on. I should be able to use it to modify the ItemInfo display.

Thanks again for all your help! Have a good weekend.
Nathan
 
Just a FYI for others trying to get some UI indication when an item can be picked up. The easiest solution is to add a Pickup and Interact ability to your player character, both with the same settings (distance, layer, etc). You can add a UI image or string to the interact message.

You will need to add an Interactable (from UCC) component to your pickup item and a simple script that returns true for CanInteract, like this:
Code:
public class VSInteractableUIS : MonoBehaviour, Opsive.UltimateCharacterController.Traits.IInteractableTarget
{
    // Start is called before the first frame update
    public bool CanInteract(GameObject character)
    {
        return true;
    }
    public void Interact(GameObject character)
    {
    }
}

and connected like this:
xxkiVmn.png


It's not elegant but it's a simple solution that will be easy to undo if a better solution is added to the integration package.
 
Top