private void CreateLineMask() { if (editorTarget.dataSource == null) { Debug.LogError("Container isn't set. Please specify a GameObject which contains transforms as children."); return; } List <Vector3> positions = GetPositions(); // closed path: connect last with first position if (closedPath.boolValue && positions.Count > 1) { // add first position as last position positions.Add(positions[0]); } mask.ClearNodes(); mask.AddNodesToEnd(positions.ToArray()); VegetationStudioProUtils.RefreshVegetation(); }
private void CreateLineMask() { if (extension.container == null) { Debug.LogError("Container isn't set. Please specify a GameObject which contains transforms as children."); return; } Vector3[] positions = extension.container.GetComponentsInChildren <Transform>().Select(x => x.position).ToArray(); // closed path: connect last with first position if (closedPath.boolValue && positions.Length > 1) { // resize array by 1 Array.Resize(ref positions, positions.Length + 1); // add first position as last position positions[positions.Length - 1] = positions[0]; } mask.ClearNodes(); mask.AddNodesToEnd(positions); }