// Update is called once per frame void Update() { if (!DestructionActive || !Input.GetMouseButtonDown(0)) { return; } Ray ray = _mainCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (!Physics.Raycast(ray, out hitInfo, Mathf.Infinity, _buildingMask)) { return; } SimpleMapPlaceable mapPlaceable = hitInfo.collider.gameObject.GetComponent <SimpleMapPlaceable>(); if (!mapPlaceable) { return; } _buildingManager.RemoveMapPlaceable(mapPlaceable.transform.position); }