// Update is called once per fram void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = cameraHelper.ScreenPointToRay(); RaycastHit info = new RaycastHit(); if (bvh.RayDetection(ray, info)) { info.transform.GetComponent <Renderer>().material.color = Color.green; } } }