Difference in GameObject speed on maximize and minimize Scene

when i play this game on minimize Scene, its okay with speed and performance. but when i run this game on Maximize Screen, its rocket’s speed comes down. How can i solve this.?

Hi Usama,

Did you multiply Time.deltaTime with the thrust? If so, remove that and test your game again. You could also implement a slightly different solution in your code. See what I did here.

  bool isThrusting = false;

    private void RespondToThrustInput()
    {
        isThrusting = Input.GetKey(KeyCode.Space);

        if (isThrusting)
        {
            ApplyThrust();
        }
        else
        {
            audioSource.Stop();
            mainEngineParticles.Stop();
        }
    }

    private void ApplyThrust()
    {
        if (!audioSource.isPlaying)
        {
            audioSource.PlayOneShot(mainEngine);
        }

        mainEngineParticles.Play();
    }

    private void FixedUpdate()
    {
        if (isThrusting)
        {
            rigidBody.AddRelativeForce(Vector3.up * mainThrust, ForceMode.Acceleration);
        }
    }

Did this fix it?

1 Like

Yes i did multiply with time.deltatime to increase movement in left right and Upword direction… so now should i remove detatime from only upward direction or from left & right as well??

How do you rotate the rocket? With the Rigidbody component? If so and if you used the suggested code, do the same for the rotation.

1 Like

Yes am using Rigidbody component and it is showing very slow movement on maximize screen play

and my Unity screen is not showing Enum screen as well…

Yes am using Rigidbody component

In that case, remove Time.deltaTime from the rotation method. You could even adjust your code in accordance with the code I posted above.

https://docs.unity3d.com/ScriptReference/Rigidbody.MoveRotation.html

and my Unity screen is not showing Enum screen as well…

Is your Inspector set to Debug mode? Click on the menu icon in the top right corner of the Inspector to check that.

1 Like

Thank you sooooooooooo much​:hugs:. Am done with my problem :smiley:

Fantastic! :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms