It is good to see there is finally a good example but i think things are missing from it like when clicked on a hotspot or if people want a key to press like f for example then it goes in inventory and when clicked on inventory item like a pistol for example it gets equiped. so with the new integration how would I do this because i had this working when it was the old integration where i had to call a custom action i scipted.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The updated integration supports using both AC Hotspots and UCC Interactables.
See the included FirstAndThirdPerson example scene: the dummies are AC Hotspots and can be interacted with using the InteractionA input, while the button at the end is a UCC Interactable and can be interacted with using the Action input.
This UCC button also demontrates how inventory items can be used on UCC Interactables. When used, the ActionList it runs uses the Inventory: Check selected Action to determine which item the player is holding.
Item syncing in the example is handled via the AC_UCC_Item component, which gets attached to Item objects. This syncing working by having AC items react to UCC items - so if a UCC item gets picked up, the associated AC item also gets picked up, and so on.
This is achieved by hooking into UCC's inventory events. For the reverse - i.e., collecting an AC item results in you picking up its associated UCC item - you can instead hook into AC's inventory events:
You'd then just need to fill in these functions with the relevant UCC code to update the UCC inventory, i.e. select the UCC item, add the UCC item to the UCC inventory, etc. See UCC's own docs for details on how to access the UCC inventory through script.
When combining two game-wide assets such as AC and UCC, though, the finer details of an integration will come down to the specific needs of your project. If you need more advice on bridging the two together, you'll need to share more detail about exactly what it is you're looking to do.
I really don't know how to script properly sorry but I did this in an action.
/*
*
* Adventure Creator
* by Chris Burton, 2013-2020
*
* "ActionTemplate.cs"
*
* This is a blank action template.
*
*/
using UnityEngine;
using Opsive.UltimateCharacterController.Inventory;
using System.Collections.Generic;
if UNITY_EDITOR
using UnityEditor;
endif
namespace AC
{
}
I did it so if I click on the pistol in inventory it gets equiped. It does work still.
You'll be getting a Console error if you don't have "Is player?" checked, because you need to set m_Character to be the Player if so.
Here's a cleaned-up and fixed version:
That'll also report the result of the Action in the Console. If it's showing, but the UCC character has no change, you'll need to look into it on the UCC side of things.