private static GameObject Reuse(Reusable r, Vector3 position, Quaternion rotation) { r.ResetForReuse(); r.LockForReuse(); var res = r.gameObject; res.transform.position = position; res.transform.rotation = rotation; res.SetActive(true); r.AfterReuse(); return(res); }
private void OnValidate() { if (_didInit) { Capacity = _buffer.Capacity; TemplateObject = Template.gameObject; Debug.LogWarning("You cannot change a pool's template or capacity after it has been initialized."); } else if (TemplateObject != null) { Template = TemplateObject.As <Reusable>(Search.InChildren); if (Template == null) { TemplateObject = null; Debug.LogWarning( "The specified template object must have a component that extends 'Reusable'."); } } }