Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by Rob_Kuato · Jul 23, 2012 at 04:30 PM · editorconsole

Catching double-clicking console messages

We are using a custom DebugUtils class which provides some nice tweaks such as filtering messages by person or type.

The problem is that when you double click the console window, it makes Mono load up the DebugUtils class/function and not the original calling script.

Can anyone suggest a solution or direction to look into that will make double clicking one of these messages go to the orignal script?

Cheers!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cregox · Aug 15, 2013 at 09:53 PM 0
Share

duped! http://answers.unity3d.com/questions/238229/debugconsole-console-clicking.html

avatar image krnd · Apr 22, 2019 at 10:36 AM 0
Share

check out https://answers.unity.com/questions/176422/debug-wrapper-class.html

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by iwHiteRabbiT · Mar 12, 2015 at 03:15 PM

I had the same problem, then I just made a simple DLL (with Mono) with this unique static class :

 using System;
 using UnityEngine;
 
 namespace [MyNameSpace]
 {
     public static class MyDebug
     {
         public static string TAG = "MyUnity";
 
         public static string CurrentClass
         {
             get {
                 var st = new System.Diagnostics.StackTrace();
 
                 var index = Mathf.Min(st.FrameCount - 1, 2);
 
                 if (index < 0)
                     return "{NoClass}";
 
                 return "{" + st.GetFrame(index).GetMethod().DeclaringType.Name + "}";
             }
         }
 
         public static void Log(string Msg)
         {
             if (Debug.isDebugBuild)
                 Debug.Log(string.Format("{0}:{1}:{2}", TAG, CurrentClass, Msg));
         }
 
         public static void LogWarning(string Msg)
         {
             Debug.LogWarning(string.Format("{0}:{1}:{2}", TAG, CurrentClass, Msg));
         }
 
         public static void LogError(string Msg)
         {
             Debug.LogError(string.Format("{0}:{1}:{2}", TAG, CurrentClass, Msg));
         }
     }
 }


Then, back in Unity you just have to past your plugin.dll in your asset folder and in the code side:

 using [MyNameSpace];
 
 // In method
 MyDebug.Log("My message log");

In the console you will see: "MyUnity:{ClassName}:My message log" And if you dbl click on it you will open the ClassName file at the right line!

It works like a charm!

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kaezin · Aug 19, 2018 at 12:02 AM 0
Share

Do you know if this still works? I tried this on Unity 2017.3.0f3 and it didn't work, then updated to 2018.2.0b4 and still haven't had any luck.

avatar image Le-nain Kaezin · Aug 22, 2018 at 03:31 PM 0
Share

@$$anonymous$$aezin I just tried it and it did work (U2018.2.3f1).

avatar image Kaezin Le-nain · Aug 24, 2018 at 03:31 AM 0
Share

Thanks for the verification. I took another look at it and this was a problem due to me placing my dll's pdb in the Assets folders ins$$anonymous$$d of just the dll. That generated a mdb file, which I assume then caused Unity to try to debug my plugin.

I resolved my issue by deleting the pdb and mdb files and now everything works great.

Show more comments
avatar image wcw · Oct 29, 2018 at 07:24 AM 0
Share

It works for me! Thanks

avatar image
0

Answer by ianjosephfischer · Jan 12, 2013 at 09:33 AM

I've been working on something like this. I can open the external editor at the correct spot, but I am searching for something that will let me set the console double click goto position.

Here is my code for that which gets called by my internal debugging system. If you found out how let me know or if any one else has any tips.

     private static void OpenFile()
     {
         Assembly assembly = Assembly.GetAssembly(typeof(UnityEditor.SceneView));
         System.Type type = assembly.GetType("UnityEditorInternal.InternalEditorUtility");
         if(type == null)
         {
             Debug.Log("Failed to open source file");
             return;
         }

         string[] stackFrames = System.Environment.StackTrace.Split(new char[] {'\n' });
         string callingFrame = stackFrames[4];

         string[] splitLog = callingFrame.Split(':');
         char drive = splitLog[0][splitLog[0].Length-1];
         string filePath = splitLog[1];
         splitLog[2] = StringManipulation.TrimStartString(
             splitLog[2], "line ");
         int lineNumber = int.Parse(StringManipulation.GetBeforeNextChar(
             splitLog[2], '\n'));


         string fullDrive = drive + ":" + filePath;

         //Debug.Log(@fullDrive + " line #" + lineNumber );
         MethodInfo method = type.GetMethod("OpenFileAtLineExternal");
         method.Invoke(method, new object[] { @fullDrive, lineNumber });
     }

(Here is that "StringManipulation" method I use which I am sure you could have figured out if you are reading this question.

 public static string GetBeforeNextChar(string sourceString, char trimed)
 {
     string[] splits = sourceString.Split(trimed);
     return splits[0];
 }
 public static string TrimStartCharacter(string sourceString, char trimed)
 {
     sourceString = sourceString.TrimStart(trimed);
     return sourceString;
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Inhuman Games · Nov 24, 2013 at 06:12 PM

Our editor console replacement asset has this feature, see the second feature discussed in this video:

Console Enhanced

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Martin_Gonzalez · May 17, 2019 at 08:48 PM

It has to be a DLL yes or yes? I'm trying this in 2018.3.11 and it opens the MyDebug class

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image iwHiteRabbiT · May 17, 2019 at 10:21 PM 0
Share

Yes and like $$anonymous$$aezin said, make sure you don't put the pdb/mdb files.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

host set to C:\Program Files\Unity\Hub\Editor\2019.4.9f1\Editor\Data\Tools\RoslynScripts\..\.. 0 Answers

Should not be capturing when there is a hotcontrol 10 Answers

How do I get rid of FMOD errors in the console: "An error occured that wasn't supposed to. Contact support." 2 Answers

DebugConsole console clicking 5 Answers

Developer Console doesn't show up when using BuildOptions.Developer 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges