How to rotate an Instantiated object?

Hello i need help rotating lasers becuase when my player rotates, the laser does not face the direction the player is shooting. Here's some of my script right now -

' var ourRotation : int = transform.rotation.y;

if(Input.GetButtonDown("Jump")) {

//create our laser

var laser0 = Instantiate(laserPrefab, transform.Find("spawn").transform.position,Quaternion.identity);

//add force to our laser

laser0.rigidbody.AddForce( transform.forward * force);

//rotate our laser

laser0.Rotate(0, ourRotation, 0);



Aside: be aware that we're doing a lot of dynamic lookups (in this case three):


If this is inner-loop code, you'll want to save those references.