- Home /
Logcat debugging?
I am walking into a error I can not pinpoint down because Logcat is giving me incorrect line numbers without filenames. Currently it says:
The reference script on this Behavious is missing and that should be easy to fix. But I get this in between scene switch. And there is no filename and a strange line number in the logcat: Filename: Line:1788
I made a debug log just before the scene switch and on Awake() of my script in the next scene. And in between these logs this error shows up. I am getting some more errors after this that I can pinpoint and they have the same results in logcat, no file name and 1788 as the line number as well.
So is there a way that I can log the line numbers and file names correctly like in the Unity console? I am using the UI monitor in the tools map of the android SDK. I tried enabling "script debugging" in the build settings but this results in a flood of "Profiler is only supported in Unity Pro."
Answer by cowlinator · Feb 08, 2015 at 07:37 AM
There is no filename because it can't find the file in the first place. If it appears to be happening in between scenes, then there is probably a missing script in the 2nd scene (the one you are switching to). Does this warning not show up in the editor? You can also use this FindMissingScripts script in the editor to help you track down missing monobehaviours: http://wiki.unity3d.com/index.php?title=FindMissingScripts
I cannot use the editor, I am developping a multiplayer game with the Google play services API.
I see. I would suggest setting up some script(s) to provide your game with phoney, $$anonymous$$imal multiplayer data in the case that you are in the editor, so you can play your game in the editor. It takes some time, but will probably be worth it.
"The reference script on this Behaviour is missing" error is actually a warning, not an error. Is your game working correctly? If so, you can probably just ignore the warning. If it's not working correctly, this warning may or may not be the cause of your game breaking.
Either way, you should be able to look at your second scene in the editor, and see if there are any objects with script components on them that are missing their script reference (assu$$anonymous$$g you aren't attaching any monobehaviours to objects at runtime).
If you can't find it that way, you could put a debug log in every single script's Awake(), and see if there are any awakes missing. That would tell you if any type of script you expect to be in the scene actually has no instances in the scene.
You could also try using
GameObject.FindObjectsOfType<Component>() or GameObject.FindObjectsOfType<$$anonymous$$onoBehaviour>()
and comparing the result against what you expect.
Also, in regards to the flood of "Profiler is only supported in Unity Pro" messages, that is supposedly because you have code calling methods in the Profiler class (although I haven't confirmed this)
Your answer
Follow this Question
Related Questions
Keep getting AudioTrack messages when I use Android logcat with my unity app. 0 Answers
[Closed] What is "Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp line: 54" 0 Answers
How to remove all unity's debug output from Android 1 Answer
Solving a crash with help from logcat 0 Answers
Android Debug USB 7 Answers