private void Fire()
{
GameObject laser = Instantiate(
laserPrefab,
transform.position,
Quaternion.identity) as GameObject;
laser.GetComponent<Rigidbody2D>().velocity = new Vector2(0, -projectileSpeed);
}
I’m still new at coding so this might be a silly question, but why is it that when we instantiated the laserPrefab we determinde “as GameObject” at the end and we don’t have to do it when we instatiate the particle explosion? Same question with the transform Quaternion.identity.
Destroy(gameObject);
GameObject particleExplosion = Instantiate(deathVFX, transform.position, transform.rotation);