private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { GameObject bullet = m_ScriptablePool.Rent(true); BulletExample bulletComponent = bullet.GetComponent <BulletExample>(); bullet.transform.position = transform.position; bulletComponent.Reset(); bulletComponent.Push(); //BulletExample bulletComponent = _bulletComponentPool.Rent(false); //bulletComponent.transform.position = transform.position; //bulletComponent.Reset(); //bulletComponent.GetComponent<Renderer>().material.color = Random.ColorHSV(0.8f, 1.0f); //bulletComponent.gameObject.SetActive(true); //bulletComponent.Push(); //GameObject bullet = _bulletPool.Rent(false); //BulletExample bulletComponent = bullet.GetComponent<BulletExample>(); //bullet.transform.position = transform.position; //bulletComponent.Reset(); //bullet.GetComponent<Renderer>().material.color = Random.ColorHSV(0.8f, 1.0f); //bullet.SetActive(true); //bulletComponent.Push(); } }
void Update() { if (Input.GetKeyDown(KeyCode.Space)) { GameObject bullet = m_BulletPool.Rent(false); BulletExample bulletComponent = bullet.GetComponent <BulletExample>(); bullet.transform.position = transform.position; bulletComponent.Reset(); bullet.SetActive(true); bulletComponent.Push(); } }