0
\$\begingroup\$

Hey all I have a quick question.

I am new and obviously still learning the basics of programming/scripting. However I am confused by the result of a simple script.

The goal is to have a Start Menu with a 3d background.The camera is attached to an Empty Object, which has a script that is meant to constantly rotate.

My confusion, is whether I am live testing in Unity, or a built executable. When the empty object is rotating, it will have a pause or a few milliseconds, and then continue with its rotation. Almost like a planned micro stutter. Regardless of where it is in its cycle. How can I make the rotation as perfectly smooth as possible?

Below is the script for rotating the empty object that the camera is attached to.

public class cameraAnchor : MonoBehaviour {

public float speed = 5f;

// Update is called once per frame
void Update () {

    //rotate camera anchor around y axis
    transform.Rotate(Vector3.down, speed * Time.deltaTime);
}

}

\$\endgroup\$
  • \$\begingroup\$ Have you tried toggling vertical sync on or off? \$\endgroup\$ – Chris McFarland Apr 21 '18 at 7:48
  • 1
    \$\begingroup\$ You're already correcting the rotation speed for deltaTime, so from this code alone the rotation should be perfectly smooth. It's likely that your stutter is caused by something else entirely, like the garbage collector kicking in or a synchronous load / heavy script use bogging down the main thread. Is there any pattern to when you observe the stutter? Have you opened up the profiler to look for any spikes around that time? \$\endgroup\$ – DMGregory Apr 21 '18 at 9:20
  • 1
    \$\begingroup\$ Thank you for the advice. DMGregory was correct. It was something else entirely. Turns out it wasnt even Unity. My power supply was failing, therefore not pushing enough power to function at proper speeds. Problem is fixed, Thank you both :) \$\endgroup\$ – theBrokenVerticie Apr 21 '18 at 9:44
1
\$\begingroup\$

The problem was hardware related rather than software. I had a hardware malfunction that caused the issue.

If anyone is experiencing a "lag" in your computers processing speed it could be software, virus, or hardware related. Perform a thorough diagnostic before assuming anything.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.