Display console log on a UI Text component












2















I need to display my console errors in a UI Text in my Unity Project, so, when I make a formal android build, if there's some error I could know.
Thanks.










share|improve this question

























  • docs.unity3d.com/ScriptReference/…

    – Retired Ninja
    Nov 16 '18 at 4:06











  • Do you want to display an error message to a user or for debugging purposes?

    – CaTs
    Nov 16 '18 at 4:13











  • If you have Android Studio and Android SDK then you can use the monitor.bat.

    – Everts
    Nov 16 '18 at 9:30











  • There's also Consolation for a lightweight in-game debug console. (I haven't tried Log Viewer, though it looks like it has more features.)

    – sonny
    Dec 5 '18 at 15:19
















2















I need to display my console errors in a UI Text in my Unity Project, so, when I make a formal android build, if there's some error I could know.
Thanks.










share|improve this question

























  • docs.unity3d.com/ScriptReference/…

    – Retired Ninja
    Nov 16 '18 at 4:06











  • Do you want to display an error message to a user or for debugging purposes?

    – CaTs
    Nov 16 '18 at 4:13











  • If you have Android Studio and Android SDK then you can use the monitor.bat.

    – Everts
    Nov 16 '18 at 9:30











  • There's also Consolation for a lightweight in-game debug console. (I haven't tried Log Viewer, though it looks like it has more features.)

    – sonny
    Dec 5 '18 at 15:19














2












2








2








I need to display my console errors in a UI Text in my Unity Project, so, when I make a formal android build, if there's some error I could know.
Thanks.










share|improve this question
















I need to display my console errors in a UI Text in my Unity Project, so, when I make a formal android build, if there's some error I could know.
Thanks.







c# android unity3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 8:19









Programmer

78.5k1091161




78.5k1091161










asked Nov 16 '18 at 3:59









Sergio MarquezSergio Marquez

417




417













  • docs.unity3d.com/ScriptReference/…

    – Retired Ninja
    Nov 16 '18 at 4:06











  • Do you want to display an error message to a user or for debugging purposes?

    – CaTs
    Nov 16 '18 at 4:13











  • If you have Android Studio and Android SDK then you can use the monitor.bat.

    – Everts
    Nov 16 '18 at 9:30











  • There's also Consolation for a lightweight in-game debug console. (I haven't tried Log Viewer, though it looks like it has more features.)

    – sonny
    Dec 5 '18 at 15:19



















  • docs.unity3d.com/ScriptReference/…

    – Retired Ninja
    Nov 16 '18 at 4:06











  • Do you want to display an error message to a user or for debugging purposes?

    – CaTs
    Nov 16 '18 at 4:13











  • If you have Android Studio and Android SDK then you can use the monitor.bat.

    – Everts
    Nov 16 '18 at 9:30











  • There's also Consolation for a lightweight in-game debug console. (I haven't tried Log Viewer, though it looks like it has more features.)

    – sonny
    Dec 5 '18 at 15:19

















docs.unity3d.com/ScriptReference/…

– Retired Ninja
Nov 16 '18 at 4:06





docs.unity3d.com/ScriptReference/…

– Retired Ninja
Nov 16 '18 at 4:06













Do you want to display an error message to a user or for debugging purposes?

– CaTs
Nov 16 '18 at 4:13





Do you want to display an error message to a user or for debugging purposes?

– CaTs
Nov 16 '18 at 4:13













If you have Android Studio and Android SDK then you can use the monitor.bat.

– Everts
Nov 16 '18 at 9:30





If you have Android Studio and Android SDK then you can use the monitor.bat.

– Everts
Nov 16 '18 at 9:30













There's also Consolation for a lightweight in-game debug console. (I haven't tried Log Viewer, though it looks like it has more features.)

– sonny
Dec 5 '18 at 15:19





There's also Consolation for a lightweight in-game debug console. (I haven't tried Log Viewer, though it looks like it has more features.)

– sonny
Dec 5 '18 at 15:19












1 Answer
1






active

oldest

votes


















4














The Application.logMessageReceived event is invoked when there is a log. Subscribe to it then get the text from it and assign it to the Text component. For older version of Unity, Application.RegisterLogCallback should be used.



public Text logText;

void OnEnable()
{
Application.logMessageReceived += LogCallback;
}

void OnDisable()
{
Application.logMessageReceived -= LogCallback;
}

void LogCallback(string logString, string stackTrace, LogType type)
{
logText.text = logString;
//Or Append the log to the old one
//logText.text += logString + "rn";
}




This will get your started and let you view the log on the Android device but if you want a complete solution, use the Log Viewer plugin from the assetstore. It has a complete UI system that lets you view the log like the Console log from the Editor:



enter image description here






share|improve this answer



















  • 1





    I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

    – derHugo
    Nov 16 '18 at 5:05












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53331233%2fdisplay-console-log-on-a-ui-text-component%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














The Application.logMessageReceived event is invoked when there is a log. Subscribe to it then get the text from it and assign it to the Text component. For older version of Unity, Application.RegisterLogCallback should be used.



public Text logText;

void OnEnable()
{
Application.logMessageReceived += LogCallback;
}

void OnDisable()
{
Application.logMessageReceived -= LogCallback;
}

void LogCallback(string logString, string stackTrace, LogType type)
{
logText.text = logString;
//Or Append the log to the old one
//logText.text += logString + "rn";
}




This will get your started and let you view the log on the Android device but if you want a complete solution, use the Log Viewer plugin from the assetstore. It has a complete UI system that lets you view the log like the Console log from the Editor:



enter image description here






share|improve this answer



















  • 1





    I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

    – derHugo
    Nov 16 '18 at 5:05
















4














The Application.logMessageReceived event is invoked when there is a log. Subscribe to it then get the text from it and assign it to the Text component. For older version of Unity, Application.RegisterLogCallback should be used.



public Text logText;

void OnEnable()
{
Application.logMessageReceived += LogCallback;
}

void OnDisable()
{
Application.logMessageReceived -= LogCallback;
}

void LogCallback(string logString, string stackTrace, LogType type)
{
logText.text = logString;
//Or Append the log to the old one
//logText.text += logString + "rn";
}




This will get your started and let you view the log on the Android device but if you want a complete solution, use the Log Viewer plugin from the assetstore. It has a complete UI system that lets you view the log like the Console log from the Editor:



enter image description here






share|improve this answer



















  • 1





    I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

    – derHugo
    Nov 16 '18 at 5:05














4












4








4







The Application.logMessageReceived event is invoked when there is a log. Subscribe to it then get the text from it and assign it to the Text component. For older version of Unity, Application.RegisterLogCallback should be used.



public Text logText;

void OnEnable()
{
Application.logMessageReceived += LogCallback;
}

void OnDisable()
{
Application.logMessageReceived -= LogCallback;
}

void LogCallback(string logString, string stackTrace, LogType type)
{
logText.text = logString;
//Or Append the log to the old one
//logText.text += logString + "rn";
}




This will get your started and let you view the log on the Android device but if you want a complete solution, use the Log Viewer plugin from the assetstore. It has a complete UI system that lets you view the log like the Console log from the Editor:



enter image description here






share|improve this answer













The Application.logMessageReceived event is invoked when there is a log. Subscribe to it then get the text from it and assign it to the Text component. For older version of Unity, Application.RegisterLogCallback should be used.



public Text logText;

void OnEnable()
{
Application.logMessageReceived += LogCallback;
}

void OnDisable()
{
Application.logMessageReceived -= LogCallback;
}

void LogCallback(string logString, string stackTrace, LogType type)
{
logText.text = logString;
//Or Append the log to the old one
//logText.text += logString + "rn";
}




This will get your started and let you view the log on the Android device but if you want a complete solution, use the Log Viewer plugin from the assetstore. It has a complete UI system that lets you view the log like the Console log from the Editor:



enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 4:21









ProgrammerProgrammer

78.5k1091161




78.5k1091161








  • 1





    I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

    – derHugo
    Nov 16 '18 at 5:05














  • 1





    I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

    – derHugo
    Nov 16 '18 at 5:05








1




1





I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

– derHugo
Nov 16 '18 at 5:05





I just wanted to suggest to use Log Viewer until I saw you already did it here ;)

– derHugo
Nov 16 '18 at 5:05




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53331233%2fdisplay-console-log-on-a-ui-text-component%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues