// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Space)) { isSpawn = !isSpawn; } if (isSpawn) { for (int i = 0; i < 5; i++) { LargePoolBullet bullet = BulletPoolManager.Instance.RequestObject(); bullet.ObjectActive(); } } if (Input.GetMouseButtonDown(0)) { //click left button Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { ClickEvent click = new ClickEvent(hit.transform.gameObject); click.Trigger(); } } if (Input.GetMouseButtonDown(1)) { //click right mouse //clear event ClickEvent.ClearListener(); } }