Been trying to get a 2d shooting script to work the past few hours and it’s frustrating now. Could anyone point out what I need to change? First time I work with 2d in Unity. Thanks in advance!
This is attached to the Player. It just spawns infront of it without doing anything. Any ideas? Thanks again.
#pragma strict
var BubblePrefab : Rigidbody;
var BubbleSpawn : Transform;
var spawnDistance : float = 10.0f;
function Start () {
}
function Update () {
if (Input.GetKeyDown(KeyCode.Space)) {
GameObject.Instantiate(BubblePrefab, BubbleSpawn.position, BubbleSpawn.rotation);
transform.position += Time.deltaTime * 5 * transform.forward;
}
}