i would like to change the rotation of my object to 90 degrees when its spawns

typically my object is facing upwards which is its basic 0 degrees what i want is to spawn at 90 degrees which means facing left that is towards the player

this is my spawn function
void Spawn(){

Instantiate (obj[Random.Range (0, obj.GetLength (0))], transform.position, Quaternion.identity);
Invoke (“Spawn”, Random.Range (spawnmin, spawnmax));
}

Hold the reference of the instantiated prefab in a Gameobject variable and then check this out: spawnedGameObject.transform.rotation = new vector3(x-rotation, y-rotation, z-rotation).

You can use Quaternion.Euler to set the initial rotation.

void Spawn(){
    Instantiate (obj[Random.Range (0, obj.GetLength (0))], transform.position, Quaternion.Euler(0, 0, 90));
    Invoke ("Spawn", Random.Range (spawnmin, spawnmax)); 
}

You will probably have to fiddle with the angle and the sign to get the exact rotation you want, but it should be easy to modify the code above to suit your needs.

Tip: Try to use code tags in the future, and this question probably belongs in the Scripting forum.

thanks a lot shaderop your code worked exactly like i wanted to