예제 #1
0
        public void SetCache(GameObject prefabInstance, PrefabContentKey contentKey)
        {
            PrefabCacheTrackerComponent prefabCacheTrackerComponent = prefabInstance.AddComponent <PrefabCacheTrackerComponent>();

            prefabCacheTrackerComponent.SetContentKey(contentKey);
            prefabCacheTrackerComponent.ObjectDestroyed += onPrefabInstanceDestroyed;
            cachedPrefabs.Add(prefabCacheTrackerComponent);
        }
예제 #2
0
 private void onPrefabInstanceDestroyed(PrefabCacheTrackerComponent trackerComponent)
 {
     trackerComponent.ObjectDestroyed -= onPrefabInstanceDestroyed;
     cachedPrefabs.Remove(trackerComponent);
     gameObjectContentCache.Release(trackerComponent.ContentKey);
 }