public void AddCacheType(string cacheName) { GameObjectCaching.GameComponentCache cache = GameObjectCaching.GetCacheByName(cacheName); if (cache == null) { return; } if (cacheTypeNames == null) { cacheTypeNames = new List <string>(); cacheTypes = new List <GameObjectCaching.GameComponentCache>(); } else if (cacheTypeNames.Contains(cacheName)) { return; } cacheTypeNames.Add(cacheName); cacheTypes.Add(cache); // Sadly, when we call this in the type constructor of a derived type we've already called AddChild for that type // in the GameComponent constructor so we can't put AddToCache there. cache.addFunction(this); }
public void RefreshCacheTypes() { if (cacheTypeNames == null) { return; } cacheTypes = new List <GameObjectCaching.GameComponentCache>(cacheTypeNames.Count); for (int i = 0; i < cacheTypeNames.Count; i++) { GameObjectCaching.GameComponentCache cache = GameObjectCaching.GetCacheByName(cacheTypeNames[i]); if (cache == null) { continue; } cacheTypes.Add(cache); cache.addFunction(this); } }