void Start() { mbShowErrorMessage = true; mbUseGyro = false; //load some settings from PlayerPrefs DInput.load(); rot = Quaternion.identity; //Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; //set Frame Rate hint to 60 FPS Application.targetFrameRate = 60; #if UNITY_EDITOR #elif UNITY_ANDROID // Java part DiveJava.init(); dive_set_path(Application.persistentDataPath); Network.logLevel = NetworkLogLevel.Full; use_udp(1); initialize_sensors(); int err = get_error(); if (err == 0) { mbShowErrorMessage = false; mbUseGyro = true; if (correctCenterTransition) { get_q(ref q0, ref q1, ref q2, ref q3); rot.x = -q2; rot.y = q3; rot.z = -q1; rot.w = q0; Quaternion temp = Quaternion.identity; temp.eulerAngles = new Vector3(0, rot.eulerAngles.y, 0); this.centerTransition = Quaternion.identity * Quaternion.Inverse(temp); } if (no.GetDeviceDefaultOrientation() == NaturalOrientation.LANDSCAPE) { is_tablet = 1; Debug.Log("Dive Unity Tablet Mode activated"); } else { Debug.Log("Dive Phone Mode activated"); } } else { mbShowErrorMessage = true; mbUseGyro = false; } #elif UNITY_IPHONE initialize_sensors(); mbShowErrorMessage = false; mbUseGyro = true; #endif }
void Start() { mbShowErrorMessage = true; mbUseGyro = false; //load some settings from PlayerPrefs DInput.load(); rot = Quaternion.identity; //Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; //set Frame Rate hint to 60 FPS Application.targetFrameRate = 60; #if UNITY_EDITOR #elif UNITY_ANDROID // Java part DiveJava.init(); javadiveplugininstance = DiveJava.javadiveplugininstance; dive_set_path(Application.persistentDataPath); Network.logLevel = NetworkLogLevel.Full; use_udp(1); initialize_sensors(); int err = get_error(); if (err == 0) { mbShowErrorMessage = false; mbUseGyro = true; if (correctCenterTransition) { get_q(ref q0, ref q1, ref q2, ref q3); rot.x = -q2; rot.y = q3; rot.z = -q1; rot.w = q0; Quaternion temp = Quaternion.identity; temp.eulerAngles = new Vector3(0, rot.eulerAngles.y, 0); this.centerTransition = Quaternion.identity * Quaternion.Inverse(temp); } String answer; String startuplog; answer = javadiveplugininstance.Call <string>("initializeDive"); answer = javadiveplugininstance.Call <string>("getDeviceType"); startuplog = javadiveplugininstance.Call <string>("getStartupLog"); if (answer == "Tablet") { is_tablet = 1; Debug.Log("Dive Unity Tablet Mode activated"); } else { Debug.Log("Dive Phone Mode activated " + answer); } } else { mbShowErrorMessage = true; mbUseGyro = false; } #elif UNITY_IPHONE initialize_sensors(); mbShowErrorMessage = false; mbUseGyro = true; #endif }