Grtschnk Posted May 22, 2017 Share Posted May 22, 2017 Thank you sarbian! This is gold! Quote Link to comment Share on other sites More sharing options...
allista Posted June 28, 2017 Share Posted June 28, 2017 Having problems with the Profiler on Unity-on-linux. As soon as the debug LinuxPlayer (renamed to KSP.x86_64, etc.) runs and the UnityEditor connects to it, the Player stops (as if at breakpoint). If I then switch (Profiler tab) the Connected Player from LinuxPlayer(localhost) to Editor, the Player resumes and runs as if nothing happens. Choosing it again freezes it again. Have someone any experience with the Profiler on linux and, perchance, knows a fix/workaround? Quote Link to comment Share on other sites More sharing options...
sarbian Posted June 28, 2017 Author Share Posted June 28, 2017 11 minutes ago, allista said: Having problems with the Profiler on Unity-on-linux. As soon as the debug LinuxPlayer (renamed to KSP.x86_64, etc.) runs and the UnityEditor connects to it, the Player stops (as if at breakpoint). If I then switch (Profiler tab) the Connected Player from LinuxPlayer(localhost) to Editor, the Player resumes and runs as if nothing happens. Choosing it again freezes it again. Have someone any experience with the Profiler on linux and, perchance, knows a fix/workaround? KSP Main Menu > Settings > General > Simulate In Background ? Quote Link to comment Share on other sites More sharing options...
allista Posted June 28, 2017 Share Posted June 28, 2017 (edited) 7 minutes ago, sarbian said: KSP Main Menu > Settings > General > Simulate In Background ? Nope, checked it first of all. It does look like SIGSTOP or breakpoint. Editor connects, process stops (black screen, no CPU activity); Editor disconnects, everything resumes. The only notion of a similar problem I found was about an Android player that similarly freezes/unfreezes on connection, but that was an old thread with the "update version of Unity" kind of solution. Edit: debugging with MonoDevelop works alright, though. Edited June 28, 2017 by allista Quote Link to comment Share on other sites More sharing options...
sarbian Posted June 28, 2017 Author Share Posted June 28, 2017 1 minute ago, allista said: Nope, checked it first of all. It does look like SIGSTOP or breakpoint. Editor connects, process stops (black screen, no CPU activity); Editor disconnects, everything resumes. The only notion of a similar problem I found was about an Android player that similarly freezes/unfreezes on connection, but that was an old thread with the "update version of Unity" kind of solution. I ll get on with the obvious checks : the Unity version match KSP's (5.4) ? Quote Link to comment Share on other sites More sharing options...
allista Posted June 28, 2017 Share Posted June 28, 2017 Just now, sarbian said: I ll get on with the obvious checks : the Unity version match KSP's (5.4) ? It does not, because linux version of Unity is still a beta with versions like 2017.1.0b. But there's no errors in Editor.log, either. I'll try to setup the 5.4.0p4 in POL and see how that works... Quote Link to comment Share on other sites More sharing options...
sarbian Posted June 28, 2017 Author Share Posted June 28, 2017 I see a bunch of 5.4 downloads in the thread. Quote Link to comment Share on other sites More sharing options...
allista Posted June 28, 2017 Share Posted June 28, 2017 21 minutes ago, sarbian said: I see a bunch of 5.4 downloads in the thread. Stupid me, really Thank's a lot, that did help. Quote Link to comment Share on other sites More sharing options...
sirkut Posted March 2, 2018 Share Posted March 2, 2018 This worked like a charm for me. Mega props for figuring this out! Quote Link to comment Share on other sites More sharing options...
fatcargo Posted June 13, 2018 Share Posted June 13, 2018 Debugging update on Windows for : KSP 1.4.3 build 2152 Unity3D 2017.1.3p1 Visual Studio 2017 v15 Original Instructions are mostly OK except for : - debug version of Unity player needs to be named "Unity.exe" (see notes below) - mklink command now needs to be "mklink /J Unity_Data KSP_x64_Data" (case insensitive, see notes below) [NOTES] If debug player is not named "Unity.exe", unity addon will not recognize it and will present empty "Select Unity Instance" window, offering network debugging via "Input IP" option where it needs both IP address and PORT. For IP address its simple, if VS debugger and game are on same machine but, there will be problem with PORT since (at least in my case) debug player changes port with each game run. Debug player is looking for Data folder named as "NameOfEXE_Data". [/NOTES] Note also that because KSP 1.4.x now runs on new version of Unity3D, old debugger addons no longer work (at least in my case, your expirience may differ) for example Xamarin or older VS2015. ... and yes yes i know i necropost, but to me this is "official" thread about debugging, and this is where i first got a working debug. I felt it needed updating. Paging dr. @sarbian please as time permits to update OP. Thanks in advance ! Quote Link to comment Share on other sites More sharing options...
Dagger Posted June 13, 2018 Share Posted June 13, 2018 (edited) I have it named as: KSP_x64_Dbg.exe and it works fine for me. But in mi case the linked folder is KSP_x64_Dbg_Data so that might be it... Edited June 13, 2018 by Dagger Quote Link to comment Share on other sites More sharing options...
sarbian Posted June 13, 2018 Author Share Posted June 13, 2018 (edited) Well... I have no problem with the exe and link naming in my debugging install. Your problem looks like what happends when the debug file (PlayerConnectionConfigFile) is missing. Edited June 13, 2018 by sarbian Quote Link to comment Share on other sites More sharing options...
fatcargo Posted June 13, 2018 Share Posted June 13, 2018 6 hours ago, sarbian said: Well... I have no problem with the exe and link naming in my debugging install. Your problem looks like what happends when the debug file (PlayerConnectionConfigFile) is missing. I then stand corrected. Thanks for reply ! I was lucky (and spent lots of time on it) to find out why is my install so finicky Quote Link to comment Share on other sites More sharing options...
Angelo Kerman Posted June 21, 2018 Share Posted June 21, 2018 @sarbian Thanks for providing these directions! After about four years of debugging plugins the old fashioned way with just Debug.Log, I finally got tired of it, upgraded my Visual Studio, and tried to set up VS debugging. The updated directions work great for my laptop, and I'm able to debug KSP 1.4.3 with Unity 2017.1.3.p1. Following the same directions on my desktop, however, my Visual Studio 2017 isn't able to connect to the KSP development build. I'm not sure why, as both KSPs on the laptop and desktop are set up the same, both Visual Studios and Unity editors are set up the same as well. When I select Debug -> Attach Unity Debugger, I see the following: I tracked down the output_log, and here's what I see in the first few lines: Spoiler Mono path[0] = 'C:/KSPDev/KSP_x64_Dbg_Data/Managed' Mono config path = 'C:/KSPDev/KSP_x64_Dbg_Data/Mono/etc' PlayerConnection initialized from C:/KSPDev/KSP_x64_Dbg_Data (debug = 0) PlayerConnection initialized network socket : 0.0.0.0 55175 Multi-casting "[IP] 10.0.1.11 [Port] 55175 [Flags] 3 [Guid] 308044216 [EditorId] 3247424759 [Version] 1048832 [Id] WindowsPlayer(Enterprise) [Debug] 1" to [225.0.0.222:54997]... Waiting for connection from host on [0.0.0.0:55175]... Timed out. Continuing without host connection. Started listening to [0.0.0.0:55175] Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56216 PlayerConnection already initialized - listening to [0.0.0.0:55175] Player data archive not found at `C:/KSPDev/KSP_x64_Dbg_Data/data.unity3d`, using local filesystem Initialize engine version: 2017.1.3p1 (02d73f71d3bd) GfxDevice: creating device client; threaded=1 Direct3D: Version: Direct3D 9.0c [nvldumdx.dll 23.21.13.8813] Renderer: NVIDIA GeForce GTX 680 Vendor: NVIDIA VRAM: 4063 MB (via DXGI) Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 INTZ=1 NULL=1 RESZ=0 SlowINTZ=0 ATOC=1 BC4=1 BC5=1 Begin MonoManager ReloadAssembly For my laptop, where I can debug successfully, here's the output: Spoiler Mono path[0] = 'C:/KSPDev/KSP_x64_Dbg_Data/Managed' Mono config path = 'C:/KSPDev/KSP_x64_Dbg_Data/Mono/etc' PlayerConnection initialized from C:/KSPDev/KSP_x64_Dbg_Data (debug = 0) PlayerConnection initialized network socket : 0.0.0.0 55211 Multi-casting "[IP] 10.0.0.238 [Port] 55211 [Flags] 3 [Guid] 4135053456 [EditorId] 3247424759 [Version] 1048832 [Id] WindowsPlayer(Columbia) [Debug] 1" to [225.0.0.222:54997]... Waiting for connection from host on [0.0.0.0:55211]... Timed out. Continuing without host connection. Started listening to [0.0.0.0:55211] Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56456 PlayerConnection already initialized - listening to [0.0.0.0:55211] Player data archive not found at `C:/KSPDev/KSP_x64_Dbg_Data/data.unity3d`, using local filesystem Initialize engine version: 2017.1.3p1 (02d73f71d3bd) GfxDevice: creating device client; threaded=1 Direct3D: Version: Direct3D 9.0c [nvldumdx.dll 22.21.13.8205] Renderer: NVIDIA GeForce GTX 960M Vendor: NVIDIA VRAM: 2019 MB (via DXGI) Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 INTZ=1 NULL=1 RESZ=0 SlowINTZ=0 ATOC=1 BC4=1 BC5=1 Begin MonoManager ReloadAssembly Here's what my development folders look like: Finally, here's a random image: Any ideas what's going on with my desktop install of the development environment? It's really puzzling that the laptop works but the desktop does not. Off the top of my head, I wonder if there's a firewall blocking the debugger on the desktop. Has anybody else seen this issue? Thanks for your help! Quote Link to comment Share on other sites More sharing options...
sarbian Posted June 21, 2018 Author Share Posted June 21, 2018 For some it seems the PlayerConnectionConfigFile I provide does not work. Launch Unity with an empty project, find the build game menu (File I think ?) set the build to dev, launch the build and save somewhere. You should have a PlayerConnectionConfigFile somewhere in there that hopefully will be better tailored to your PC. Quote Link to comment Share on other sites More sharing options...
Angelo Kerman Posted June 22, 2018 Share Posted June 22, 2018 6 hours ago, sarbian said: For some it seems the PlayerConnectionConfigFile I provide does not work. Launch Unity with an empty project, find the build game menu (File I think ?) set the build to dev, launch the build and save somewhere. You should have a PlayerConnectionConfigFile somewhere in there that hopefully will be better tailored to your PC. Hm, maybe something else is failing? I followed the directions but I have the same issue: the debugger won't notice the KSP app. I also tried attaching to my empty Unity project and it doesn't show up either. I can attach to the Unity editor itself: Quote Link to comment Share on other sites More sharing options...
fatcargo Posted June 22, 2018 Share Posted June 22, 2018 (edited) I've tried also with alternate PlayerConnectionConfigFile generated on my system (which is kind of paradox since locally generated file is actually original, but i'm splitting hairs here ) and no luck. I then renamed my KSP debug player to "Unity.exe" (and added .pdb file from same editor install location where i copied debug player), made new link to folder and it (again) worked without a hitch. When i was googling around i found some post over on unity forums that unity debugger for VS needed to find "Unity.exe" process. Ehhh i guess this works too. If both debug player and editor are run at the same time, you can tell the difference because editor will have project name in list of debug listeners, ksp debug player will have that entry empty. Finally, if above does not work you can resort to listing all processes in system that have open listen ports (two TCP and one UDP, usually the second TCP is one you should connect to). Then open VS unity debugger and choose "Input IP" and enter 127.0.0.1:PORT. Problem is (at least on my machine) that every time ksp debug player is run, PORT number changes Oh and word of caution : i just noticed that VS unity debugger sees KSP debug player as "Editor". I don't know if it matters, but i tried inserting a breakpoint and it seems to work. Edited June 22, 2018 by fatcargo typo Quote Link to comment Share on other sites More sharing options...
Angelo Kerman Posted June 22, 2018 Share Posted June 22, 2018 Thanks guys, I’ll give this a try. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted June 22, 2018 Share Posted June 22, 2018 Just an FYI, Someone contacted me claiming that one of my mods was generating endless exceptions in his debugger build and was saying it was mu fault. When he finally sent me the info on the exception, it turned out that there was a try/catch, where I was writing the exception message to the log, and it was THAT which was null (the exception was for a filenotfound). So somehow, his debug buld was creating its own issues. That being said, I think I’ll be trying this for 1.4.4 in a few days. Quote Link to comment Share on other sites More sharing options...
Aerospike Posted October 23, 2018 Share Posted October 23, 2018 (edited) Hey there. Having to update my KSP modding environment after an eternity, I came across a few things that seem to be outdated. Example Unity version: I think the OP could require an update, as KSP 1.1 won't be of relevance for most new developers. For KSP 1.4.x - 1.5.x the correct unity version is Unity 2017.1.3p1 as pointed out by fatcargo above. Finding out the Unity version when a new KSP version is released: the output_log.txt/Player.log. seems to be no longer existent. So no luck finding the Unity version there. Instead, simply right click the KSP.exe / KSP_x64.exe -> Properties -> Details -> the entry "File version" tells you the Unity version, but it tells you something like 2017.1.3.55103. No idea how to figure out the required patch version without trying every possibility? Creating a "junction" using mklink in a command prompt: if you are on windows and like to work with the newest tools, you might have wondered if there is a way to use powershell instead of the old command. Fortunately there finally is one now: New-Item -Path KSP_x64_Dbg_Data -Type Junction -Value KSP_x64_Data (arguably mklink requires less typing ) After a few hours of messing around, I got everything to work again (had downloaded the wrong unity version, not the correct patch version) and now I just have to update my build configurations for the new ksp versions and then I can actually start working on the mod again... Edited October 24, 2018 by Aerospike Quote Link to comment Share on other sites More sharing options...
micha Posted October 24, 2018 Share Posted October 24, 2018 (edited) 9 hours ago, Aerospike said: Finding out the Unity version when a new KSP version is released: the output_log.txt/Player.log. seems to be no longer existent. So no luck finding the Unity version there. The output_log.txt has moved; it can be found in %UserProfile%\AppData\LocalLow\Squad\Kerbal Space Program\output_log.txt now. Edited October 24, 2018 by micha Fixed path Quote Link to comment Share on other sites More sharing options...
Aerospike Posted October 24, 2018 Share Posted October 24, 2018 (edited) Thank you @micha! I actually searched for "*kerbal*" in AppData\Local and AppData\Roaming as that is where most apps usually put their stuff. I think I never had any app put anything of interest into "LocalLow". So I didn't bother to search there as well. Doh! Edited October 24, 2018 by Aerospike Quote Link to comment Share on other sites More sharing options...
micha Posted October 24, 2018 Share Posted October 24, 2018 3 hours ago, Aerospike said: Thank you @micha! I actually searched for "*kerbal*" in AppData\Local and AppData\Roaming as that is where most apps usually put their stuff. I think I never had any app put anything of interest into "LocalLow". So I didn't bother to search there as well. Doh! To be honest, the only way I found it was because the Unity Debug Player has a built-in log-viewer with a button to open the log file. I'd never have thought to look in LocalLow myself; it's certainly a first. Interestingly enough you can also find the data which Unity captures and forwards to their servers there too. Quote Link to comment Share on other sites More sharing options...
mattssheep4 Posted December 7, 2018 Share Posted December 7, 2018 (edited) I've come up with this error somehow:I've double and triple checked that KSP_64_Dbg_Data is linked to KSP_x64_Data, and that the dll is actually there, but it doesn't accept that for some reason. Any ideas? I was looking for the wrong dll *facepalm* Edit: Now it says: "Failed to load mono". I've tried everything I could think of, copying all the files into the install folder which gave me another error: "Failed to initialize player. Details: Failed to load PlayerSettings (internal index #0). Most likely data file is corrupted, or built with mismatching editor and platform support versions." Edit 2: So I had two versions of Unity installed and was using the wrong one. Never mind, thanks anyways! (Feeling like an idiot now lol) Edited December 7, 2018 by mattssheep4 Quote Link to comment Share on other sites More sharing options...
NermNermNerm Posted December 20, 2018 Share Posted December 20, 2018 In celebration of my glorious victory of having got it so that I can hit a breakpoint in my completely non-functional first KSP mod, I'll post the spots where I had to go off-road to get things installed. First, unlike one poster I read, I was easily able to get the Unity version from output_log.txt - so far so good, but it was 2017.1.3p1 and the version given out on the link from the instruction page only deals out 2017.1.3f1 ('f' not 'p' -- 'f' for final, maybe?) Anyway, I found it here instead: https://unity3d.com/unity/qa/patch-releases Might be a good idea to modify the post to point to that as a possible place to look and point out that close does not count in this game. This is a minor thing, but this bit: On 3/29/2015 at 4:09 AM, sarbian said: Get this zip and put its content somewhere. For me it will be "C:\Games\Tools\pdb2mdb" is probably more work than you need - I haven't tested it to make sure this is true in every regard, but I think you get pdb2mdb with your unity installation, here: C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5 On 3/29/2015 at 4:09 AM, sarbian said: You need a version that allows plugin. So either a 201x Pro+ or Visual Studio Community 2015 (it is free and Unity most likely already installed it). You also have to install the Tools for Unity extension (also free). Get the one for your VS version and install it. I think this is now wrong. I'm sure it was probably right once, but not now. The "Tools for Unity" doesn't offer anything to download except Visual Studio, which you don't need to re-download. I believe that if you started the process with nothing, then you'd get Visual Studio with Unity enabled by downloading Unity. If you already had Visual Studio 2017 at the start of the process (like me), you should be installing it with the "Visual Studio Installer" -- start up the installer, go to "Modify" and poke around until you see the Unity box. Thanks for maintaining this! This thread is a really valuable resource. Hey, I'm moaning and all, but I plugged my way through it and it didn't require that much creativity and it's sure not like the Unity guys made this process simple... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.