public void SetCache(GameObject prefabInstance, PrefabContentKey contentKey) { PrefabCacheTrackerComponent prefabCacheTrackerComponent = prefabInstance.AddComponent <PrefabCacheTrackerComponent>(); prefabCacheTrackerComponent.SetContentKey(contentKey); prefabCacheTrackerComponent.ObjectDestroyed += onPrefabInstanceDestroyed; cachedPrefabs.Add(prefabCacheTrackerComponent); }
public PrefabRequest Acquire(PrefabContentKey contentKey, Action <GameObject, PrefabRequest> callback = null) { PrefabRequest prefabRequest = new PrefabRequest { IsComplete = false, ContentKey = contentKey }; CoroutineRunner.Start(gameObjectContentCache.Acquire(contentKey, delegate(GameObject x) { onPrefabLoaded(x, prefabRequest, callback); }), this, "Loading Prefab Asset"); return(prefabRequest); }
public void Release(PrefabContentKey contentKey) { gameObjectContentCache.Release(contentKey); }
public void SetContentKey(PrefabContentKey contentKey) { ContentKey = contentKey; }