void TestControl() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction); if (Input.GetMouseButtonDown(0)) { if (hit.collider != null) { hit.collider.gameObject.GetComponent <Block>().BlockClick(); } } else if (Input.GetMouseButtonDown(1)) { if (hit.collider != null) { createManager.LightToggle(hit.collider.gameObject); } } }