void OnEnable()
        {
            if (itemDatabase != null && itemData != null)
            {
                // refresh the item's data from the item database
                itemData = itemDatabase.GetItem(itemData.name);
            }

            if (_vrInventory == null)
            {
                _vrInventory = GameObject.FindObjectOfType <VRInventory>();
                if (_vrInventory == null)
                {
                    Debug.LogWarning("Warning: Inventory item could not locate a valid VRInventory object to attach to.");
                    return;
                }
            }

            if (_eventTrigger == null)
            {
                _eventTrigger = this.GetComponent <EventTrigger>();
                if (_eventTrigger == null)
                {
                    _eventTrigger = this.gameObject.AddComponent <EventTrigger>();
                }
            }

            // clear any existing events, just in case this is called more than once
            _eventTrigger.triggers.Clear();

            CreateEvent(this.gameObject, EventTriggerType.PointerDown, PickItemUp);
            CreateEvent(this.gameObject, EventTriggerType.PointerEnter, OnPointerEnter);
            CreateEvent(this.gameObject, EventTriggerType.PointerExit, OnPointerExit);
        }
        public static void NewVRInventory()
        {
            var playerPrefabGuid = AssetDatabase.FindAssets("t:Prefab PlayerPrefab").FirstOrDefault();

            if (string.IsNullOrEmpty(playerPrefabGuid))
            {
                Debug.LogWarning("[MobileVRInventory] Player Prefab not found.");
                return;
            }
            var playerPrefab   = (GameObject)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(playerPrefabGuid), typeof(GameObject));
            var playerInstance = GameObject.Instantiate(playerPrefab);

            playerInstance.name = "Player";

            var inventoryPrefabGuid = AssetDatabase.FindAssets("t:Prefab VRInventory").FirstOrDefault();

            if (string.IsNullOrEmpty(inventoryPrefabGuid))
            {
                Debug.LogWarning("[MobileVRInventory] VRInventory Prefab not found.");
                return;
            }
            var inventoryPrefab   = (GameObject)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(inventoryPrefabGuid), typeof(GameObject));
            var inventoryInstance = GameObject.Instantiate(inventoryPrefab);

            inventoryInstance.name = "VRInventory";

            // Find UI References
            VRInventory vrInventoryScript = inventoryInstance.GetComponent <VRInventory>();

            vrInventoryScript.inventoryPositionTransform = GameObject.Find("InventoryPosition").transform;
            vrInventoryScript.handPosition = GameObject.Find("HandPosition").transform;

            // Add an event system if necessary
            var        eventSystem   = GameObject.FindObjectOfType <EventSystem>();
            GameObject eventSystemGO = null;

            if (eventSystem == null)
            {
                eventSystemGO = new GameObject("EventSystem");
                eventSystemGO.AddComponent <EventSystem>();
            }
            else
            {
                eventSystemGO = eventSystem.gameObject;
            }

            // Add the Gaze Input Module if necessary
            var gazeInputModule = eventSystemGO.GetComponent <GazeInputModuleInventory>();

            if (gazeInputModule == null)
            {
                eventSystemGO.AddComponent <GazeInputModuleInventory>();
            }

            // link the trigger to the VRInventory
            var trigger = playerInstance.GetComponentInChildren <VRInventoryTrigger>();

            trigger.vrInventory = vrInventoryScript;
        }
        void OnEnable()
        {
            SO_target                    = new SerializedObject(target);
            itemDatabase                 = SO_target.FindProperty("itemDatabase");
            inventoryTriggerMode         = SO_target.FindProperty("inventoryTriggerMode");
            hideWhenItemSelected         = SO_target.FindProperty("hideWhenItemSelected");
            showInventoryItemsInEditMode = SO_target.FindProperty("showInventoryItemsInEditMode");
            inventoryUIPrefab            = SO_target.FindProperty("inventoryUIPrefab");
            itemTemplate                 = SO_target.FindProperty("itemTemplate");
            inventoryPositionTransform   = SO_target.FindProperty("inventoryPositionTransform");
            handPosition                 = SO_target.FindProperty("handPosition");
            onItemSelected               = SO_target.FindProperty("onItemSelected");
            onItemPickedUp               = SO_target.FindProperty("onItemPickedUp");

            autoSave     = SO_target.FindProperty("autoSave");
            saveSlotName = SO_target.FindProperty("saveSlotName");

            vrInventoryTarget = target as VRInventory;
        }
 // Use this for initialization
 void Start()
 {
     myAnim            = GetComponent <Animator>();
     vrInventory       = GameObject.FindObjectOfType <VRInventory>();
     exampleController = GameObject.FindObjectOfType <VRInventoryExampleSceneController>();
 }