private void Awake() { m_Rigidbody = GetComponent <Rigidbody>(); m_particleManager = Instantiate <GameObject>(m_particleManager); m_bulletParticles = m_particleManager.GetComponent <BulletParticles>(); m_bulletParticles.transform.position = transform.position; m_bulletParticles.velocity = -GetComponent <Rigidbody>().velocity / 5; m_bulletParticles.random = -m_bulletParticles.velocity.normalized; }
// ... protected void instantiateParticles(GameObject gameObject) { GameObject obj = Instantiate(gameObject); obj.transform.position = transform.position; BulletParticles bulletParticles = gameObject.GetComponent <BulletParticles>(); if (bulletParticles) { if (bulletParticles.orientToBullet) { obj.transform.rotation = transform.rotation; } } //objectsToUnparentOnDestroy.Add(obj.transform); }