I created "rotate.cs" & attached it to a prefab which gets instantiated during play mode. The gameobject which spawns is supposed to rotate constantly. For some reason, it rotates only in scene view & not in game view. Note: I used play mode with oculus quest 2 in VR. I took off the headset to check whether the spawned gameobject's rotation was changing in the inspector or not & it was changing.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Rotate : MonoBehaviour

    // Start is called before the first frame update
    void Start()


    // Update is called once per frame
    void Update()
        transform.Rotate(0f, 250 * Time.deltaTime, 0f, Space.Self);

Here are the instantiated prefab's components & hierarchy: inspector window

  • 1
    \$\begingroup\$ I tested your code and it's working as intended. Can you show how your Prefab's hierarchy appears, and how you assigned the script in the editor? \$\endgroup\$
    – liggiorgio
    Jul 6 at 12:48
  • \$\begingroup\$ @liggiorgio i just added a screenshot of the instantiated prefab's components & hierarchy in the post \$\endgroup\$
    – ahiyantra
    Jul 6 at 13:29


You must log in to answer this question.

Browse other questions tagged .