- Home /
How can I get the last log made on the Debug console as a string?
I want to get the last log made on the console as a string variable. I am using this is solely for unity unit testing.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Deathdefy · Feb 23, 2018 at 07:03 PM
   protected virtual void Start()
     {
         Application.logMessageReceived += Application_logMessageReceived;
     }
  string condition;
     private void Application_logMessageReceived(string condition, string stackTrace, LogType type)
     {
         this.condition = condition;
     }
 
     private void OnDestroy()
     {
         Debug.Log(condition);
     }
Ran this as a quick test. Seemed to re-output the last console message that I put into it.
Answer by villevli · Feb 23, 2018 at 07:04 PM
See the example on this page: Application.logMessageReceived
Your answer
 
 
             Follow this Question
Related Questions
iPhone: Can output normally sent to Debug.Log be sent to Xcode Console 1 Answer
Console does not prints the same message again 1 Answer
What is Wrong With This Script? 3 Answers
Access function from variable (sounds weard, i'll explain) 1 Answer
How to determine if a game object is a generated prefab using code 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                