Game behaves differently between editor (Windows) and hardware (Android)

Hello, I have a script that should restart the level with the default variables: SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);. When this code executes in the editor everything works as intended and the level rotation is set to 0 however when I try this on the hardware level rotation gets messed up and rotates to the angle script is called instead of the default angle of the level. For the first time in a while, I think this is not my fault and is about Unity instead, If any developer wants to look into the code I can share some snippets.

  1. It almost always is an oversight of the developer and not the engine (especially for code)
  2. Always share affected code
1 Like

please share your code, it’s 100% code related issue, just create 2 new empty scenes and test your script witout any other script.

I can’t test this with empty scenes since it requires the rotation value however I can share some of the code.

Here is a largely cut down version of the GameManager: using UnityEngine.UI;using UnityEngine.SceneManagement;using UnityEngine; - Pastebin.com
Here is some of LevelGenerator: using UnityEngine;public class LevelGenerator : MonoBehaviour { //visibl - Pastebin.com

Hope these help. If any more code is needed please tell me.

Hey, I shared the code. Is it enough code? If not I can share more.

Not going through the whole script right now, but use debug logs to see what goes wronf

I cannot use them on my phone because I don’t have the cable to do so.

Then buy a cheap usb cable…

Edit: you can also debug wirelessly using wifi

You can also write the Debug.Log output to the UI into a (temporary for now) text field. That is what I do on the Sample IAP Project , very handy for debugging (no cable required!). This may help too https://discussions.unity.com/t/748729/14

private void MyDebug(string debug)
    {
        Debug.Log(debug);
        myText.text += "\r\n" + debug;
    }