Last active
December 14, 2015 06:38
-
-
Save NickDiMucci/5043765 to your computer and use it in GitHub Desktop.
Example showing GetComponent usage to access a prefab's script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Transform bullet; | |
private void fireBullet() { | |
Transform gameObject = Instantiate(bullet, gun.position, gun.rotation) as Transform; | |
gameObject.GetComponent<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