void OnApplicationQuit() { for (int i = 0; i < transform.childCount; i++) { InventoryObject invOb = transform.GetChild(i).GetComponent <InventoryObject>(); if (invOb != null) { invOb.Save(invOb.GetType().ToString()); } } }
void Awake() { instance = this; eventSystem = FindObjectOfType <EventSystem>(); canvas = transform.GetComponentInChildren <Canvas>(); if (canvas == null) { canvas = transform.GetComponentInParent <Canvas>(); } if (character == null) { Debug.LogError("Please set the Character field in the Inventory Manager GameObject"); } if (dropTransform == null) { Debug.LogError("Please set the Drop Transform field in the Inventory Manager GameObject"); } if (cameraComponent == null) { Debug.LogError("Please set the Camera Component field in the Inventory Manager GameObject"); } //Load items when not in editor #if UNITY_EDITOR #else for (int i = 0; i < allInventoryObjects.Count; i++) { InventoryObject invOb = allInventoryObjects[i]; if (invOb != null) { //Load Items outside of editor invOb.Load(invOb.GetType().ToString()); } } #endif }