private GridCell CellAdded(Vector3 worldPos) { GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube); go.transform.parent = transform; go.name = "Cell"; Vector3 centre = m_centreCell ? new Vector3(m_cellSize, 0, m_cellSize) * 0.5f : Vector3.zero; go.transform.position = worldPos + centre; GridCell cell = go.AddComponent <GridCell>(); cell.Config(this, m_cellSize); //go.transform.localScale = Vector3.one * m_cellSize; go.SetActive(false); UnityEditor.Undo.RegisterCreatedObjectUndo(go, "Go"); return(cell); }