public static RectanglePreview MakePreview(RectanglePreview previewPrefab, Vector3 startPosition) { RectanglePreview preview = Instantiate(previewPrefab, startPosition, Quaternion.identity); preview.Init(startPosition); return(preview); }
/// <summary> /// Returns next available rectangle preview and sets it to active. /// Returns null if none can be sent . /// </summary> /// <returns>(Possibly) Rectangle preview fetched from pool.</returns> public RectanglePreview GetNextAvailable(Vector3 startPosition) { GameObject previewObject = pool.GetNextAvailable(); if (previewObject) { RectanglePreview previewScript = previewObject.GetComponent <RectanglePreview>(); if (previewScript) { previewScript.Init(startPosition); return(previewScript); } } return(null); }