private void BlockSelect(BlockBehaviour block) { if (block != null) { if (block != AddPiece.SelectedBlock) { BlockVisualController componentInParent = null; if (AddPiece.SelectedBlock != null) { componentInParent = AddPiece.SelectedBlock.GetComponentInParent <BlockVisualController>(); if (componentInParent != null) { componentInParent.SetNormal(); } } componentInParent = block.GetComponentInParent <BlockVisualController>(); if (componentInParent != null) { componentInParent.SetSelected(); } AddPiece.SelectedBlock = (GenericBlock)block; } } }