void OnStoreItemReady(ScriptableStoreItem item, Object asset) { // event is called at startup for downloaded items, then when bought&downloaded //add asset items to Library ScriptableLibrary lib = asset as ScriptableLibrary; // item asset is a library itself, and can contain several objects foreach (ScriptableLibraryObject scriptLibObj in lib.libObjects) { Debug.Log("STORE scriptableLibraryObject: " + scriptLibObj.displayName); LibraryObject libObj = new LibraryObject(); libObj.prefab = scriptLibObj.prefab; libObj.displayName = scriptLibObj.displayName; libObj.thumbnail = scriptLibObj.thumbnail; storeObjects.Add(libObj); // each item is appended - } ResetLibraryObjects(); }
protected virtual void FetchLibrary(ScriptableLibrary scriptableLibrary) { if (scriptableLibrary != null) { List <LibraryObject> libObjects = new List <LibraryObject>(); //foreach (GameObject prefab in scriptableLibrary.prefabs) Debug.Log("FetchLibrary " + scriptableLibrary.libObjects.Count); foreach (ScriptableLibraryObject scriptLibObj in scriptableLibrary.libObjects) { Debug.Log("scriptableLibraryObject: " + scriptLibObj.displayName); LibraryObject libObj = new LibraryObject(); libObj.prefab = scriptLibObj.prefab; libObj.displayName = scriptLibObj.displayName; libObj.thumbnail = scriptLibObj.thumbnail; libObjects.Add(libObj); } objectLibrary.SetLibraryObjects(libObjects); } else { assetLoader.ReportError("AssetBundle object: " + "scriptableLibrary.asset" + " not present or incorrect."); } }