public ProfilePool(int size) { for (var i = 0; i < size; i++) { freeProfiles.AddFirst(new Profile( )); } }
private Profile GetProfile() { var profile = freeProfiles.First.Value; if (profile == null) { profile = new Profile( ); } usedProfiles.AddFirst(profile); UnityEngine.Debug.Assert(Count < 1000); return(profile); }