I thought that this would add force once as soon as the object was created, but what happens is that the object just falls to the ground. Am I not doing this right?
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Rigidbody2D))]
public class Bullet : MonoBehaviour {
public int damageAmount;
public float speed;
public float timeToLive = 0;
// Use this for initialization
void Awake () {
rigidbody2D.AddForce(transform.forward * speed, ForceMode2D.Impulse);
Destroy(gameObject, timeToLive);
}
}