I didn't use it before because AC inventory used to work fine without it. However, after enabling Engine: Manage systems now my inventory works fine whether using AC as the source or my prefab.
That said, a new issue has appeared—when I try to use an inventory item on a hotspot, nothing happens (no action will be triggered). If I repeatedly press "E," it occasionally works, but not consistently. Any idea what might be causing this?
Is this the same issue you reported at the top of this thread?
I need more to go on to get to the bottom of it. If you can PM me your project (zip without the Library folder), along with instructions, I can take a look.
I can confirm that Chris reviewed my game's source code and created a custom inventory script for me. It worked perfectly. I really appreciate your help, Chris!
And here's the script:
using UnityEngine;
using AC;
public class InventoryHandler : MonoBehaviour
{
public Canvas canvas;
public AudioClip noHotspotSound;
void OnEnable () => EventManager.OnMenuElementClick += OnMenuElementClick;
void OnDisable () => EventManager.OnMenuElementClick -= OnMenuElementClick;
void OnMenuElementClick (Menu menu, MenuElement element, int slot, int buttonPressed)
{
if (menu.RuntimeCanvas != canvas) return;
MenuInventoryBox inventoryBox = element as MenuInventoryBox;
if (inventoryBox == null) return;
InvInstance clickedInstance = inventoryBox.GetInstance (slot);
if (!InvInstance.IsValid (clickedInstance)) return;
if (clickedInstance.InvItem.useActionList)
{
clickedInstance.Use (false);
menu.TurnOff ();
return;
}
var hotspot = KickStarter.player.hotspotDetector.GetSelected ();
if (hotspot == null || !hotspot.HasInventoryInteraction (clickedInstance.InvItem))
{
if (KickStarter.sceneSettings.defaultSound && noHotspotSound)
{
KickStarter.sceneSettings.defaultSound.audioSource.PlayOneShot (noHotspotSound);
}
return;
}
hotspot.RunInventoryInteraction (clickedInstance);
menu.TurnOff ();
}
Comments
Are you using the Engine: Manage systems Action to allow for in-game direct control of Menus, as mentioned above?
I didn't use it before because AC inventory used to work fine without it. However, after enabling Engine: Manage systems now my inventory works fine whether using AC as the source or my prefab.
That said, a new issue has appeared—when I try to use an inventory item on a hotspot, nothing happens (no action will be triggered). If I repeatedly press "E," it occasionally works, but not consistently. Any idea what might be causing this?
https://prnt.sc/sG99JueJdEbv
https://prnt.sc/i4YTc9pWt0B_
https://prnt.sc/My52L3J6P_bw
Is this the same issue you reported at the top of this thread?
I need more to go on to get to the bottom of it. If you can PM me your project (zip without the Library folder), along with instructions, I can take a look.
Thank you, Chris. I will send you the project shortly.
I can confirm that Chris reviewed my game's source code and created a custom inventory script for me. It worked perfectly. I really appreciate your help, Chris!
And here's the script:
using UnityEngine;
using AC;
public class InventoryHandler : MonoBehaviour
{
}