ScreenOrientation changing

Hi, Im new to unity coding and i have a stupid question:
is it the best way to set Gameobject position when the orientation changed?
Is it using too much process because its in the FixedUpdate?
what is the best way to reduce the processing and getting the same result?
Thank you so much
here’s a code:

void FixedUpdate ()
    {

        if (Screen.orientation == ScreenOrientation.Landscape)
        {
            torch.transform.localPosition = new Vector3(-559,176,0);

        }

        else if (Screen.orientation == ScreenOrientation.Portrait)
        {

            torch.transform.localPosition = new Vector3(-247,176,0);
   
        }
       
       
    }

I guess it would save processing power if you set the value only if the orientation has been changed, like:

private ScreenOrientation lastOrientation = ScreenOrientation.Landscape;  // or whatever the initial value is

void FixedUpdate ()
    {

        if (lastOrientation <> Screen.orientation)
        {
           if (Screen.orientation == ScreenOrientation.Landscape)
           {
               torch.transform.localPosition = new Vector3(-559,176,0);
           }

           else if (Screen.orientation == ScreenOrientation.Portrait)
           {
               torch.transform.localPosition = new Vector3(-247,176,0);
           }
           lastOrientation = Screen.orientation;
        }

    }
1 Like