Quality settings impacting output in gameplay

Hey guys!

I had an odd issue spring up today.

It was discovered in my game that if you have the quality settings all the way down, certain math related events in the game, such as the way I handle character rotation does not work as it should and is causing some game breaking issues.

I am overall very unfamiliar with how the Quality settings impact the actual scripts executing as well as any update functions. The game runs flawless on Fantastic, but on Fastest I get very strange math related issues which break the game.

As always, your insight and or suggestions would be greatly appreciated!

Thank you!

To be more exact, is there a way to make sure that this rotation is all based on Time.deltaTime?

This is my current rotation code:

while(i < 1.0)
    {
  
    i += Time.deltaTime * rate;
  
    transform.rotation = Quaternion.Lerp(startRot, endRot, Mathf.SmoothStep(0.0, 1.0, i));
     
    yield;
  
    }

Instead of getting smooth rotation, on small resolution and lower quality the rotating does not work as it does on Fantastic with a standard 16:9 ratio.

EDIT: I tested other quality settings, the rotation works perfect once I have it on at least Good Quality setting. There must be something going on with how Unity handles processing of scripts etc. in certain Quality adjustments.

I even made the script that handles the rotation the top priority in the script execution order and still have issues in Fastest, Fast and Simple.

What does “not work” and “strange issues” mean here? Does the character not rotate all the way, rotate too far, not rotate at all?

Gotta tell us what the problem is.

The character will only rotate sometimes, then freeze mid rotation or be in reverse. Very odd stuff, that as soon as I switch to Good Quality or higher all the rotation issues go away.

That should not happen due to that code.

Might it be that you’re starting several instances of that coroutine? That would cause the kinds of problems you’re describing. The higher framerate you should be getting from a lower quality level might have exposed that the code starting the coroutine is not framerate-independent.

Yes that might be it actually. The code I provided is inside of my RotateObject function. This is the code that calls it from within my Update function, do you think I need this call to be using Time.deltaTime?

if(Input.GetButtonDown("Look Left") && !l_pressed)
    {
        RotateObject(transform.rotation, Quaternion.Euler(transform.rotation.eulerAngles + Vector3.up * -90), 0.8);       
        l_pressed = true;
    }

You’re blocking RotateObject from being started when it’s already running, so that’s probably not the problem then. It’s still possible that it’s getting run several times. Try debugging creatively:

var rotatesRunning: int

function RotateObject(Quaternion startRot, Quaternion endRot, float rate) {
    rotatesRunning++;
    if(rotatesRunning > 1) {
        Debug.Log("Two instances of this coroutine is trying to rotate this object at the same time!");
    }

    //old RotateObject code

    rotatesRunning--;
}

By the way, I’m assuming that you’re writing UnityScript here, as your yield call would not make sense otherwise.

I don’t really write US, so that might not be 100% correct, but you get the idea; check if several instances of your coroutine is running at the same time. If that’s the case, both of them will be influencing the rotation of the object at the same time, and one will cancle out the other.

If that’s the case, drop the coroutines. Instead, whenever you press left or right, set a rotation goal, and rotate towards that in Update.