unity3d 捕获系统日志,来处理一些问题

注册系统日志回调,根据日志内容和类型处理一些特殊问题

using UnityEngine;

using System.Collections;



public class SetupVerification : MonoBehaviour

{

	public string message = "";

	

	

	private bool badSetup = false;

	

	

	void Awake ()

	{

		Application.RegisterLogCallback (OnLog);

	}

	



	void OnLog (string message, string stacktrace, LogType type)

	{

		if (message.IndexOf ("UnityException: Input Axis") == 0 ||

			message.IndexOf ("UnityException: Input Button") == 0

		)

		{

                   //处理异常信息

		}

	}

	

	

}


你可能感兴趣的:(unity3d)