Skip to content

Instantly share code, notes, and snippets.

@NickDiMucci
Last active December 14, 2015 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickDiMucci/5040001 to your computer and use it in GitHub Desktop.
Save NickDiMucci/5040001 to your computer and use it in GitHub Desktop.
How to get around the inability to have constructor parameters in Unity
public EnemyBullet bullet;
private void fireBullet() {
EnemyBullet enemyBullet = Instantiate(bullet, gun.position, gun.rotation) as EnemyBullet;
enemyBullet.setSpeed(speed + BULLET_SPEED_MULTIPLIER);
laser.Play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment