//-------------------------------------------------
        private void HandHoverUpdate(IF_VR_Steam_Hand hand)
        {
            if (takeBackItem && requireReleaseActionToReturn)
            {
                if (hand.isActive)
                {
                    IF_VR_Steam_ItemPackage currentAttachedItemPackage = GetAttachedItemPackage(hand);
                    if (currentAttachedItemPackage == itemPackage && hand.IsGrabEnding(currentAttachedItemPackage.gameObject))
                    {
                        TakeBackItem(hand);
                        return;                         // So that we don't pick up an IF_VR_Steam_ItemPackage the same frame that we return it
                    }
                }
            }

            if (requireGrabActionToTake)
            {
                IF_VR_Steam_GrabTypes startingGrab = hand.GetGrabStarting();

                if (startingGrab != IF_VR_Steam_GrabTypes.None)
                {
                    SpawnAndAttachObject(hand, IF_VR_Steam_GrabTypes.Scripted);
                }
            }
        }
        //-------------------------------------------------
        private IF_VR_Steam_ItemPackage GetAttachedItemPackage(IF_VR_Steam_Hand hand)
        {
            GameObject currentAttachedObject = hand.currentAttachedObject;

            if (currentAttachedObject == null)               // verify the hand is holding something
            {
                return(null);
            }

            IF_VR_Steam_ItemPackageReference packageReference = hand.currentAttachedObject.GetComponent <IF_VR_Steam_ItemPackageReference>();

            if (packageReference == null)               // verify the item in the hand is matchable
            {
                return(null);
            }

            IF_VR_Steam_ItemPackage attachedItemPackage = packageReference.itemPackage;             // return the IF_VR_Steam_ItemPackage reference we find.

            return(attachedItemPackage);
        }
        //-------------------------------------------------
        private void RemoveMatchingItemsFromHandStack(IF_VR_Steam_ItemPackage package, IF_VR_Steam_Hand hand)
        {
            if (hand == null)
            {
                return;
            }

            for (int i = 0; i < hand.AttachedObjects.Count; i++)
            {
                IF_VR_Steam_ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent <IF_VR_Steam_ItemPackageReference>();
                if (packageReference != null)
                {
                    IF_VR_Steam_ItemPackage attachedObjectItemPackage = packageReference.itemPackage;
                    if ((attachedObjectItemPackage != null) && (attachedObjectItemPackage == package))
                    {
                        GameObject detachedItem = hand.AttachedObjects[i].attachedObject;
                        hand.DetachObject(detachedItem);
                    }
                }
            }
        }
        //-------------------------------------------------
        private void OnHandHoverBegin(IF_VR_Steam_Hand hand)
        {
            IF_VR_Steam_ItemPackage currentAttachedItemPackage = GetAttachedItemPackage(hand);

            if (currentAttachedItemPackage == itemPackage)               // the item at the top of the hand's stack has an associated IF_VR_Steam_ItemPackage
            {
                if (takeBackItem && !requireReleaseActionToReturn)       // if we want to take back matching items and aren't waiting for a trigger press
                {
                    TakeBackItem(hand);
                }
            }

            if (!requireGrabActionToTake)             // we don't require trigger press for pickup. Spawn and attach object.
            {
                SpawnAndAttachObject(hand, IF_VR_Steam_GrabTypes.Scripted);
            }

            if (requireGrabActionToTake && showTriggerHint)
            {
                hand.ShowGrabHint("PickUp");
            }
        }
        //-------------------------------------------------
        private void SpawnAndAttachObject(IF_VR_Steam_Hand hand, IF_VR_Steam_GrabTypes grabType)
        {
            if (hand.otherHand != null)
            {
                //If the other hand has this item package, take it back from the other hand
                IF_VR_Steam_ItemPackage otherHandItemPackage = GetAttachedItemPackage(hand.otherHand);
                if (otherHandItemPackage == itemPackage)
                {
                    TakeBackItem(hand.otherHand);
                }
            }

            if (showTriggerHint)
            {
                hand.HideGrabHint();
            }

            if (itemPackage.otherHandItemPrefab != null)
            {
                if (hand.otherHand.hoverLocked)
                {
                    Debug.Log("<b>[SteamVR Interaction]</b> Not attaching objects because other hand is hoverlocked and we can't deliver both items.");
                    return;
                }
            }

            // if we're trying to spawn a one-handed item, remove one and two-handed items from this hand and two-handed items from both hands
            if (itemPackage.packageType == IF_VR_Steam_ItemPackage.ItemPackageType.OneHanded)
            {
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.OneHanded, hand);
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.TwoHanded, hand);
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.TwoHanded, hand.otherHand);
            }

            // if we're trying to spawn a two-handed item, remove one and two-handed items from both hands
            if (itemPackage.packageType == IF_VR_Steam_ItemPackage.ItemPackageType.TwoHanded)
            {
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.OneHanded, hand);
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.OneHanded, hand.otherHand);
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.TwoHanded, hand);
                RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType.TwoHanded, hand.otherHand);
            }

            spawnedItem = GameObject.Instantiate(itemPackage.itemPrefab);
            spawnedItem.SetActive(true);
            hand.AttachObject(spawnedItem, grabType, attachmentFlags);

            if ((itemPackage.otherHandItemPrefab != null) && (hand.otherHand.isActive))
            {
                GameObject otherHandObjectToAttach = GameObject.Instantiate(itemPackage.otherHandItemPrefab);
                otherHandObjectToAttach.SetActive(true);
                hand.otherHand.AttachObject(otherHandObjectToAttach, grabType, attachmentFlags);
            }

            itemIsSpawned = true;

            justPickedUpItem = true;

            if (takeBackItem)
            {
                useFadedPreview = true;
                pickupEvent.Invoke();
                CreatePreviewObject();
            }
        }