/// <summary>Gets a batch from the pool. Null if the pool is empty.</summary> public static UIBatch Get(Renderman renderer) { if (First == null) { return(null); } UIBatch result = First; First = result.BatchAfter; result.BatchAfter = null; result.Setup = false; // Show it: #if PRE_UNITY4 result.Mesh.OutputGameObject.active = true; #else result.Mesh.OutputGameObject.SetActive(true); #endif if (result.Renderer != renderer) { result.ChangeRenderer(renderer); } return(result); }
/// <summary>Gets a batch from the pool. Null if the pool is empty.</summary> public static UIBatch Get(Renderman renderer) { if (First == null) { return(null); } UIBatch result = First; First = result.BatchAfter; result.BatchAfter = null; result.Setup = false; // Get the GO: UnityEngine.GameObject gameobject = result.Mesh.OutputGameObject; if (gameobject == null) { // This occurs when a WorldUI gets destroyed but put its batches in the pool. // We've already removed the first so just go recursive - chances are the next one will be ok. return(Get(renderer)); } // Show it: #if PRE_UNITY4 gameobject.active = true; #else gameobject.SetActive(true); #endif if (result.Renderer != renderer) { result.ChangeRenderer(renderer); } return(result); }