How to apply a one-time (initial) impulse force

I know how to use the GetComponent<Rigidbody>().AddForce(); function. But to apply a one-time initial impulse, do I put this line in void start() or void update() ?

I’d try something like this:

public Vector3 impulse = new Vector3(5.0f, 0.0f, 0.0f);

bool m_oneTime = false;

void FixedUpdate ()
    {
    if (!m_oneTime)
        {
        GetComponent<Rigidbody>().AddForce(impulse, ForceMode.Impulse);
        m_oneTime = false;
        }
    }

Remember that the impuse is velocity multiplied by mass. If you want to give the object an initial velocity regardless it mass, use ForceMode.VelocityChange as second parameter to AddForce.

Just some minor fixes to the above code.

public class ImpulseForce : MonoBehaviour {
//Give it a momentary force of 5 in the X direction but you can change this in unity to apply
//an impulse force in any direction.
public Vector3 impulseMagnitude = new Vector3(5.0f, 0.0f, 0.0f);

bool m_oneTime = true;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void FixedUpdate()
{
if (m_oneTime)
{
GetComponent().AddForce(impulseMagnitude, ForceMode.Impulse);
m_oneTime = false;
Debug.Log(“Here”);
}
}
}

Oh! Dumb mistake, thanks! I’m editing the original post.