Heed Posted July 4, 2016 Share Posted July 4, 2016 Yeah that's what I tried, but nothing. I think there must be some step that maybe Mac Unity developers know but isn't in your instructions. Because I followed your instructions to the letter, and it does not work. Quote Link to comment Share on other sites More sharing options...
gomker Posted August 30, 2016 Share Posted August 30, 2016 (edited) I was able to get this mostly working (Development Build displayed on KSP, Attach to unity Debugger is successful, Exception Support set to true) however, none of my break points are triggering. I can see my code changes after I compile. Has anyone else seen this behavior? I am using Visual Studio 2013 on Windows 10. Thanks User error, duh moment on setting breakpoints correctly. Edited August 31, 2016 by gomker adding OS Quote Link to comment Share on other sites More sharing options...
Aerospike Posted September 17, 2016 Share Posted September 17, 2016 The unity download archive only provides a download for Unity 5.4.0f3 but KSP 1.2.0 expects Unity 5.4.0p4. In case anybody else is looking for the download of the correct Version, you can find it here: https://unity3d.com/unity/qa/patch-releases/5.4.0p4 Quote Link to comment Share on other sites More sharing options...
Padishar Posted September 19, 2016 Share Posted September 19, 2016 On 17/09/2016 at 3:57 PM, Aerospike said: The unity download archive only provides a download for Unity 5.4.0f3 but KSP 1.2.0 expects Unity 5.4.0p4. In case anybody else is looking for the download of the correct Version, you can find it here: https://unity3d.com/unity/qa/patch-releases/5.4.0p4 Unless I'm missing something, 5.4.0p4 is Unity Pro and will require a licence if you want to actually run it for profiling etc... Quote Link to comment Share on other sites More sharing options...
sarbian Posted September 19, 2016 Author Share Posted September 19, 2016 7 minutes ago, Padishar said: Unless I'm missing something, 5.4.0p4 is Unity Pro and will require a licence if you want to actually run it for profiling etc... uh, no. it is patch 4. Nothing more. All Unity version can profile now. The paying upgrade are for build,s marketing tool, removing the splash screen and the like. Quote Link to comment Share on other sites More sharing options...
Padishar Posted September 19, 2016 Share Posted September 19, 2016 Just now, sarbian said: uh, no. it is patch 4. Nothing more. All Unity version can profile now. The paying upgrade are for build,s marketing tool, removing the splash screen and the like. Hmm, when I tried downloading it I got a full install which asked me to sign in with my Unity account when I ran it. The free version doesn't do this... Quote Link to comment Share on other sites More sharing options...
Aerospike Posted September 20, 2016 Share Posted September 20, 2016 (edited) 22 hours ago, Padishar said: Hmm, when I tried downloading it I got a full install which asked me to sign in with my Unity account when I ran it. The free version doesn't do this... As far as I know the Personal Edition of Unity requires a (free) Account as well now. I'm unable to check that, because for some strange reason Unity does not want to start (it was working without problems yesterday...) Anyway: Yes, the patch is an installation file (not sure if it is a full install?). BUT! You don't even have to install it! Just open the .exe file with winzip/7-zip/winrar and extract the player file. The directory structure inside the self extracting archive is just the same as it is in your local installation of unity. Edited September 20, 2016 by Aerospike clarification Quote Link to comment Share on other sites More sharing options...
Padishar Posted September 20, 2016 Share Posted September 20, 2016 1 hour ago, Aerospike said: As far as I know the Personal Edition of Unity requires a (free) Account as well now. I'm unable to check that, because for some strange reason Unity does not want to start (it was working without problems yesterday...) Anyway: Yes, the patch is an installation file (not sure if it is a full install?). BUT! You don't even have to install it! Just open the .exe file with winzip/7-zip/winrar and extract the player file. The directory structure inside the self extracting archive is just the same as it is in your local installation of unity. No, I definitely don't have to sign in when I run the personal version of Unity. As for my strange installation problems, originally I had installed 5.4.0f3 and this was working without needing to sign in. I knew that KSP wouldn't run with the player included with that so, because it said on the Unity site that the "patch" was actually a full install, I uninstalled 5.4.0f3 first before installing the patch. This insisted I sign in with an account and when I did it said I couldn't run it because I had no licence. I need to use the Unity profiler so just copying the player file out isn't good enough. Anyway, I completely removed all traces of Unity and then reinstalled 5.4.0f3 and then installed the "patch" version without uninstalling first and now it doesn't ask me to sign in and it runs ok (though whether this was actually required is unknown). I copied the debug player into KSP 1.2 and tested the profiler within Unity and it's all working fine. Quote Link to comment Share on other sites More sharing options...
Aerospike Posted September 20, 2016 Share Posted September 20, 2016 3 minutes ago, Padishar said: No, I definitely don't have to sign in when I run the personal version of Unity. You are right of course. When launching unity without a stored login, you can either log in or choose "work offline". Guess I must have missed that button when I first installed unity and thought that I had to create an account. Quote Link to comment Share on other sites More sharing options...
micha Posted September 20, 2016 Share Posted September 20, 2016 (edited) Well, getting close. Did all the steps for Linux (including compiling the Unity debugger), can attach to the Player process (and pause it to inspect where it is at the moment etc), but cannot set breakpoints. Keeps telling me "Debugger operation failed - Target could not be interrupted". Google is of no more assistance, any ideas? KSP 1.2.0.1509 (x64, of course), Monodevelop 5.10, Debian "Jessie" EDIT: NVM, it works. It does help not having 2 copies of your DLL in GameData (one of which was the original non-Debug version)... been tearing my hair out why my changes weren't doing anything! Edited September 20, 2016 by micha Stupid Me Quote Link to comment Share on other sites More sharing options...
Stavell Posted September 30, 2016 Share Posted September 30, 2016 So when watching items in the Watch panel of the Debugging console. some items have a blue box and others have a wrench beside them. I have seen the same variable change between the two. What do they mean? Quote Link to comment Share on other sites More sharing options...
Ser Posted October 8, 2016 Share Posted October 8, 2016 (edited) Guys, I have a trouble with getting my Mono to debug KSP 1.2 on Windows I've done everything like @sarbian told (got the right Unity, patched it, replaced exe with the player from Unity, put "PlayerConnectionConfigFile" to KSP_x64_Data folder) and got KSP running in development mode. But when I try to attach to process in Mono there's no processes listed. If I have Unity Editor running at that time, it shows the Editor but no luck with KSP. I feel that I'm one step away but can't figure out what am I doing wrong. Edited October 8, 2016 by Ser Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 9, 2016 Author Share Posted October 9, 2016 (edited) On 08/10/2016 at 1:01 PM, Ser said: I feel that I'm one step away but can't figure out what am I doing wrong Windows, Linux ? It works here on Windows and Mono. Are the .mdb are properly generated (I spent an hour wondering why it was not working until I noticed my pdb2mdb.exe was not where it used to be) ? Edited October 9, 2016 by sarbian Quote Link to comment Share on other sites More sharing options...
Ser Posted October 9, 2016 Share Posted October 9, 2016 (edited) 2 hours ago, sarbian said: Windows, Linux ? It works here on Windows and Mono. Are the .mdb are properly generated (I spent an hour wondering why it was not working until I noticed my pdb2mdb.exe was not where it used to be) ? I'm trying on Windows. The weirdest thing is that my Mono 5.9.6 that was installed with Unity generates a pdb file instead of mdb and I have no idea how to change it, so I had to convert it with pdb2mdb and then put both near the plugin's dll. Is it really an mdb file that makes KSP appear in the process list? If so, when it should appear in the list if my plugin initializes at the flight scene? What do you mean by " pdb2mdb.exe was not where it used to be"? It just woked and generated an mdb file. Have no idea whether its contents are properly generated. Is there a way to check it? Edited October 9, 2016 by Ser Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 9, 2016 Author Share Posted October 9, 2016 Indeed, the missing mdb should not prevent the process from showing up in the list. Did you test with the unity editor profiler ? In Unity go to the Windows menu and choose Profiler. The window has an "Active profile" button up top that show the list of thing that it can profile. You should see the "WindowPlayer" when KSP runs. Since you have the gfame running in dev mode I guess the only remaing culprit would be the "PlayerConnectionConfigFile" in KSP_x64_Data (you launch the x64 build right ?). Windows did not sneak in an extension to the file name ? You may want to build a dumy/empty project game in Unity with the "Development Build" check box checked. It will create that file in the build and you could try to use that one instead of mine. Quote Link to comment Share on other sites More sharing options...
Ser Posted October 9, 2016 Share Posted October 9, 2016 (edited) @sarbian I've tried what you said: Have built a new Unity project with Development build, Autoconnect profiler and Script debugging enabled, and replaced your PlayerConnectionConfigFile with generated one. It contains the string "listen 1143278402 1 1" - the numbers are slightly different from yours. Unity profiler starts to show signs of life once KSP is launched: in the Overview column there's FlightCamera, FlightGlobals, Krakensbane etc. The interesting thing is that in the "Active profiler" dropdown there's still only "Editor" and "<Enter IP>" listed but the Editor isn't checked. Mono doesn't see the KSP process as well. Looks like Unity can't list the process but can profile it though Tried disabling my firewall but with no result. Edited October 9, 2016 by Ser Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 9, 2016 Author Share Posted October 9, 2016 Well, all I can suggest now is to try VS with the VS Tools for Unity installed or restart the whole process with a clean KSP... Quote Link to comment Share on other sites More sharing options...
Ser Posted October 9, 2016 Share Posted October 9, 2016 (edited) @sarbian Thanks for your help, I've managed to get it working. The steps that helped me: Replaced contents of the PlayerConnectionConfigFile with the string: listen 1143278402 1 1 (not sure if that's necessary) Generated the .mdb file with the pdb2mdb shipped with Unity, i.e \Unity\Editor\Data\Mono\lib\mono\2.0\pdb2mdb.exe Started MonoDevelop after KSP. That have brought WindowsPlayer (that is KSP) to process list to attach to. Windows, KSP 1.2, Unity 5.4.0p4, Mono Develop 5.9.6 shipped with Unity Edited October 9, 2016 by Ser Quote Link to comment Share on other sites More sharing options...
RockyTV Posted October 28, 2016 Share Posted October 28, 2016 (edited) I've been trying to debug a mod and I get these messages on the dev console: get_realtimeSinceStartup can only be called from the main thread What are the suggestions? Is there any way to patch it? EDIT: can't remove these calls (Time.realtimeSinceStartup) from the mod code as the whole mod depends on it. Edited October 28, 2016 by RockyTV Quote Link to comment Share on other sites More sharing options...
Padishar Posted October 28, 2016 Share Posted October 28, 2016 (edited) 11 hours ago, RockyTV said: I've been trying to debug a mod and I get these messages on the dev console: get_realtimeSinceStartup can only be called from the main thread What are the suggestions? Is there any way to patch it? EDIT: can't remove these calls (Time.realtimeSinceStartup) from the mod code as the whole mod depends on it. When running under the debugger, certain things are done from a different thread to the main one. You are probably initialising some variable with the result of that function in a constructor (or just directly in the class definition). Set it to a sensible value there instead (e.g. 0) and then do the call to get_realtimeSinceStartup in the Start or Awake function of your class... BTW: a link to github or other way to view the source is always helpful when trying to get help with plugin development... Edited October 28, 2016 by Padishar Quote Link to comment Share on other sites More sharing options...
sarbian Posted November 30, 2016 Author Share Posted November 30, 2016 A great article on Unity and Garbage collection with everything explained for those not used to managed lang https://unity3d.com/learn/tutorials/topics/performance-optimization/optimizing-garbage-collection-unity-games Quote Link to comment Share on other sites More sharing options...
Kurld Posted February 3, 2017 Share Posted February 3, 2017 Finally ran across this thread. It sure does make debugging my plugins and exploring the API a lot easier. Thanks so much for sharing this information! Quote Link to comment Share on other sites More sharing options...
Dizor Posted February 13, 2017 Share Posted February 13, 2017 On 08.10.2016 at 2:01 PM, Ser said: when I try to attach to process in Mono there's no processes listed I have had the same trouble but with Visual Studio. The solution for my case was: KSP Main Menu > Settings > General > Simulate In Background (should be ON). Quote Link to comment Share on other sites More sharing options...
Kobymaru Posted March 21, 2017 Share Posted March 21, 2017 Hi! Is it currently possible to do Edit-and-Continue with KSP and Visual Studio? Quote Link to comment Share on other sites More sharing options...
sarbian Posted March 21, 2017 Author Share Posted March 21, 2017 Unfortunately no 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.