找回密码
 注册帐号

扫一扫,访问微社区

application.registerlogcallback 注册日志回调

2014-12-31 09:02| 发布者: 杨炎| 查看: 3501| 评论: 0|原作者: 蛮牛|来自: unity3d脚本manual

摘要: application.registerlogcallback 注册日志回调static functionregisterlogcallback(handler:application.logcallback) : voiddescription描述register a delegate to be called on log messages.在一个日志信息上注 ...

application.registerlogcallback 注册日志回调

static functionregisterlogcallback(handler:application.logcallback) : void

description描述

register a delegate to be called on log messages.

在一个日志信息上注册一个委托来被调用。

pass null to remove log handler.

通过null来去除日志处理器。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

public string output = "";

public string stack = "";

void onenable() {

application.registerlogcallback(handlelog);

}

void ondisable() {

application.registerlogcallback(null);

}

void handlelog(string logstring, string stacktrace, logtype type) {

output = logstring;

stack = stacktrace;

}

}

var output : string = "";

var stack : string = "";

function onenable () {

application.registerlogcallback(handlelog);

}

function ondisable () {

// remove callback when object goes out of scope

//当对象超出范围,删除回调。

application.registerlogcallback(null);

}

function handlelog (logstring : string, stacktrace : string, type : logtype) {

output = logstring;

stack = stacktrace;

}

see also:application.logcallback,logtype.

相关阅读

文章点评
相关文章