public object Replace(int pos, object o) { if (pos > 0 && pos < count) { object obj = list[pos].obj; list[pos].obj = o; #if UNITY_EDITOR list[pos].debugLog = PoolNode.getPath(o); #endif return(obj); } return(null); }
public int Add(object obj) { int pos = -1; if (head.index != 0) { pos = head.index; list[pos].obj = obj; #if UNITY_EDITOR list[pos].debugLog = PoolNode.getPath(obj); #endif head.index = list[pos].index; } else { pos = list.Count; list.Add(new PoolNode(pos, obj)); count = pos + 1; } return(pos); }