Hi.
In my current project, I have an initialisation scene in which the resolution of the device is detected, and 2x and 4x graphics are loaded depending on the screen size using the 2d toolkit framework (1x graphics are loaded by default for 480x320 screen sizes or smaller).
The script used to achieve this:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class Main : MonoBehaviour {
public string scene = "SceneName";
void Awake()
{
Application.targetFrameRate = 60;
if(Screen.width > 1136) {
tk2dSystem.CurrentPlatform = "4x";
}
else if( Screen.width > 480 ) {
tk2dSystem.CurrentPlatform = "2x";
}
else {
tk2dSystem.CurrentPlatform = "1x";
}
Debug.Log("CURRENT PLATFORM (main) : " + tk2dSystem.CurrentPlatform );
Debug.Log("Device data:");
Debug.Log("Screen resolution: " + Screen.width + " x " + Screen.height );
SceneManager.LoadScene(scene);
}
}
However, the crash only occurs when the resolution of the game window in the unity editor exceeds a screen width of 480. This means that the crash only occurs when 2x and 4x assets are loaded. The editor crashes to the desktop, so I can't see any of the errors displayed in the editor. However, I have attached the editor log file [here][1]. I'm not really sure how to interpret it.
Any help as to what is causing this crash and how it can potentially be avoided would be much appreciated.
Thanks in advance.
[1]: /storage/temp/61014-editorlog.zip
↧