Unity Community


Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

  1. Location
    Ryazan, Russia
    Posts
    781
    Try to not close Unity once it has been launched by MonoDevelop; use its Start/Stop buttons.

    UPD: I mean Play button.
    Last edited by alexzzzz; 01-28-2012 at 01:53 PM.


  2. Posts
    3
    Quote Originally Posted by alexzzzz View Post
    Try to not close Unity once it has been launched by MonoDevelop; use its Start/Stop buttons.

    UPD: I mean Play button.
    I have nothing but problems with Mono and debugging in Unity, i dont know if im doing something wrong or what.

    Step 1) Close Unity
    2) Start Debugger from Mono which starts Unity
    3) Start Unity project, do debugging.
    4) Stop Unity project, make changes to Mono code
    5) Unity will now not respond to any input on the Start/Stop buttons, you can do things in the menus, minimize/maximize...but cant start/stop or terminate Unity.
    6) Stop the debugger in Mono
    7) Kill Unity3d

    Sometimes it gets really bad where Unity wont let me kill it, or wont close..it asks if i want to save my Scene i hit yes then it does nothing...never closes so i task manager kill the process. Open up Unity again..BOOM my entire Scene is gone, not just not in Unity..but not in the game folder at all..its totally gone. This has happened MANY times to me and its infuriating, even with just a small prototype scene that takes 5 minutes to setup.

    It has exhibited this behavior across two windows installs, so i dont think its my system or something else causing it. I had to reformat a week or two ago and it does the same thing now on a fresh system as it did before on my loaded system.
    Last edited by FuzzeWuzze; 01-28-2012 at 02:17 PM.


  3. Posts
    3
    I came here because I was having some Default Parameter issues as well, and noticed that none of you guys seem to be aware of attaching to the currently running Unity process to debug.

    It is much faster and will definitely improve your workflow.

    While having unity and monodevelop open, click the "Attach To Process" button in Monodevelop (It's right next to [Debug (F5)]). You can also find the command under the Run toolbar button.

    Then select Unity Editor (Unity), there will be a Process ID that will change each time you open Unity, but there should probably only be one process there.

    And voila! You're attached and debugging. You can attach to the process mid-game as well, if you need to set something up or examine some odd behavior in the middle of the game itself.

    Then, if you hit Stop (Shift+F5), Unity player continues normally, and you can reattach later if you like.

    You can even use this method to attach to Development/Script Debugging versions of StandAlone builds or even iOS builds (it attaches over the network if the iOS device is on wifi). I believe it doesn't work for Web Player.
    Last edited by Agamemjohn; 03-09-2012 at 11:33 AM.


  4. Location
    Ryazan, Russia
    Posts
    781
    Name:  Captura.PNG
Views: 807
Size:  38.7 KB

    Uncheck this option and there's no need to change target framework to 4.0 anymore.


  5. Location
    Gliwice, Poland
    Posts
    335
    I've found a nice solution. Try to put this script in Assets/Editor

    Code:  
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEditor;
    4. using System.IO;
    5. using System.Text.RegularExpressions;
    6.  
    7. class UpgradeVSProject : AssetPostprocessor {
    8.     private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) {
    9.         string currentDir = Directory.GetCurrentDirectory();
    10.         string[] slnFile = Directory.GetFiles(currentDir, "*.sln");
    11.         string[] csprojFile = Directory.GetFiles(currentDir, "*.csproj");
    12.  
    13.         bool hasChanged = false;
    14.         if (slnFile != null) {
    15.             for (int i = 0; i < slnFile.Length; i++) {
    16.                 if (ReplaceInFile(slnFile[i], "Format Version 10.00", "Format Version 11.00"))
    17.                     hasChanged = true;
    18.             }
    19.         }
    20.  
    21.         if (csprojFile != null) {
    22.             for (int i = 0; i < csprojFile.Length; i++) {
    23.                 if (ReplaceInFile(csprojFile[i], "ToolsVersion=\"3.5\"", "ToolsVersion=\"4.0\""))
    24.                     hasChanged = true;
    25.  
    26.                 if (ReplaceInFile(csprojFile[i], "<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>", "<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>"))
    27.                     hasChanged = true;
    28.             }
    29.         }
    30.  
    31.         if (hasChanged) {
    32.             Debug.LogWarning("Project is now upgraded to Visual Studio 2010 Solution!");
    33.         } else {
    34.             Debug.Log("Project-version has not changed...");
    35.         }
    36.     }
    37.  
    38.     static private bool ReplaceInFile(string filePath, string searchText, string replaceText) {
    39.         StreamReader reader = new StreamReader(filePath);
    40.         string content = reader.ReadToEnd();
    41.         reader.Close();
    42.  
    43.         if (content.IndexOf(searchText) != -1) {
    44.             content = Regex.Replace(content, searchText, replaceText);
    45.             StreamWriter writer = new StreamWriter(filePath);
    46.             writer.Write(content);
    47.             writer.Close();
    48.  
    49.             return true;
    50.         }
    51.  
    52.         return false;
    53.     }
    54. }


  6. Location
    Brampton, Ontario
    Posts
    40
    Thank you genail! It's insane that Unity doesn't let you do that in the first place.


  7. Location
    Turkey, Istanbul
    Posts
    719
    @alexzzzz when you uncheck Build Project in Monodevelop it never builds in Monodevelop and you cannot see errors in Monodevelop. it would be nice it worked like build in unity and show compile errors in Monodevelop.

    @genail it is nice script but it does not work for <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> in csproj. is there any way to change target to 4.0 automatically?
    Ufuk Coban.
    Unity 4 Pro (iOS Pro, Android Basic, Flash Basic), Modo 701 (ACS,NPR,SLIK)
    iMac i7, MacBook Pro i7 HD 6750M, (Mavericks, Windows 8.1)
    iPhone 4, iPad 2/3, (iOS 7), Nokia Lumia 925 ( Phone 8 )

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •