當我殺死一個敵人時,我想去下一層,但是遊戲在我的android設備的Application.LoadLevel中崩潰。在統一編輯器中,它是正確的,加載下一級,但在Android設備崩潰。我該如何解決它?這是我的代碼:Application.LoadLevel導致我在Android上的遊戲崩潰
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using Invector;
public class PuntosPistas_RA : MonoBehaviour {
private GameObject Enemy4;
private bool doOnce4;
private GameObject Player;
void Start()
{
Enemy4 = GameObject.FindGameObjectWithTag("Enemy4");
Player = GameObject.FindGameObjectWithTag("Player");
Player.GetComponent<PuntosPistas>().Score = PlayerPrefs.GetInt("Score");
}
void Update()
{
if (Enemy4.GetComponent<v_AIController>() != null) {
if (Enemy4.GetComponent<v_AIController>().currentHealth <= 0 && doOnce4 == false) {
doOnce4 = true;
Application.LoadLevel("map");
Debug.Log("To map");
}
}
}
}
這是出現在Android設備監控的錯誤,當我測試一下:
09-28 14:04:24.343: A/libc(31857): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9c in tid 31879 (UnityMain)
09-28 14:04:24.486: W/ActivityManager(847): Force finishing activity 1 com.asm.NETPOINTBOA/com.unity3d.player.UnityPlayerNativeActivity
09-28 14:04:24.575: W/InputDispatcher(847): channel '35106e3 com.asm.NETPOINTBOA/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
09-28 14:04:24.575: E/InputDispatcher(847): channel '35106e3 com.asm.NETPOINTBOA/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
09-28 14:04:24.578: I/WindowState(847): WIN DEATH: Window{35106e3 u0 com.asm.NETPOINTBOA/com.unity3d.player.UnityPlayerNativeActivity}
09-28 14:04:24.579: W/InputDispatcher(847): Attempted to unregister already unregistered input channel '35106e3 com.asm.NETPOINTBOA/com.unity3d.player.UnityPlayerNativeActivity (server)'
我該如何得到它?在Unity中,控制檯沒有出現任何內容。它運行正常 – Angelsm
謝謝!我遵循教程,這是崩潰日誌: 09-18 21:08:11.161:A/libc(32316):致命信號11(SIGSEGV),代碼1,tid 32350(UnityMain)中的故障地址0x0 09-18 21:08:16.677:我/編舞(32316):跳過了324幀!應用程序可能在其主線程上做了太多工作。 09-18 21:08:16.678:W/AudioTrack(32316):releaseBuffer()跟蹤0xb85e9fc8由於上次的欠載運行而被禁用,重新啓動 – Angelsm
在新場景中是否有一個腳本會執行大量工作或者甚至可能卡住在無盡的循環? – JeanLuc