devdogio / Inventory-Pro

Home Page:https://devdog.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UMA integration errors

dmenefee opened this issue · comments

With the latest version of UMA 2 (2.1.0), I saw compilation errors in UMAEquippableInventoryItem.cs, in both the overlayLibrary and slotLibrary properties. To fix, use the following code snippet to set those values from the UMA PlayerManager:

    private OverlayLibraryBase _overlayLibrary;
    protected OverlayLibraryBase overlayLibrary
    {
        get
        {
            if (_overlayLibrary == null)
            {
                UMAContextBase contextBase = PlayerManager.instance.currentPlayer.GetComponent<UMADynamicAvatar>().context;
                if (contextBase is UMAContext context)
                {
                    _overlayLibrary = context.overlayLibrary;
                }
            }

            return _overlayLibrary;
        }
    }

    private SlotLibraryBase _slotLibrary;
    protected SlotLibraryBase slotLibrary
    {
        get
        {
            if (_slotLibrary == null)
            {
                UMAContextBase contextBase = PlayerManager.instance.currentPlayer.GetComponent<UMADynamicAvatar>().context;
                if (contextBase is UMAContext context)
                {
                    _slotLibrary = context.slotLibrary;
                }
            }

            return _slotLibrary;
        }
    }