title: How do I rotate an instantiated object using Quaternion?
body: <p>I have a sphere script that on collision it instantiates a cylinder (object3), then once the cylinder appears, the cylinder is supposed to rotate some way, the direction of rotation doesn't matter. But the code I have is not getting the cylinder to rotate. I've tried different lines of code and tried putting the quaternion lines in the update function and in the on collision function but neither way gets the cylinder to rotate. I am not sure if it has to do with my code at this point, or if I have to do something within unity 3d settings. Any suggestions?   </p>
  
  <pre><code>public class sphereBehavior : MonoBehaviour
  {
      public GameObject object3;
      private Vector3 direction = new Vector3(-1, 0, 0);
      private Vector3 rotateDirection = new Vector3(0, 0, 1);
  
      // Update is called once per frame
      void Update()
      {
          transform.Translate(direction * Time.deltaTime, Space.World);
          transform.Rotate(rotateDirection, Space.World);
  
          Quaternion Cylinder = Quaternion.Euler(90,50,69);
          transform.rotation = Quaternion.Slerp(transform.rotation, Cylinder, Time.deltaTime);
  
      }
  
      //void OnCollisionEnter(Collision collision) =&gt; Instantiate(object3, new Vector3(0, 1, -2), Quaternion.identity);
  
      void OnCollisionEnter(Collision collision)
      {
          Instantiate(object3, new Vector3(0, 1, -2), Quaternion.identity);
          Destroy(collision.gameObject);
      }
  
  }
  </code></pre>