Search Unity

Run and Build are greyed out in VSC 2017 Mac?

Discussion in 'Scripting' started by Disc_Pistol, Jun 18, 2018.

  1. Disc_Pistol

    Disc_Pistol

    Joined:
    Jun 15, 2018
    Posts:
    23
    Hey all, I'm Kieran. I'm a newbie to Unity, currently studying it as part of my program in game audio. So I apologize if my question is totally basic.

    I'm trying to write a few scripts, but in Visual Studio Community 2017, any and all options to build or run the code are greyed out. Even when I load up example scripts, there is no way to run them, as far as I can tell. Is this a bug? Or am I missing a simple step?

    thanks!
    -k
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    "Running" a script from Visual Studio doesn't really make sense to me. Unity will "run" any scripts when you enter Play mode, but you won't manually run the scripts in Visual Studio.

    The closest match to what you're saying is debugging a script in Visual Studio. To do that, Unity needs to be open, then you would press Attach to Unity at the top of Visual Studio (or press F5):

    upload_2018-6-17_17-25-1.png

    Did you mean something else by running scripts in Visual Studio?
     
  3. Disc_Pistol

    Disc_Pistol

    Joined:
    Jun 15, 2018
    Posts:
    23
    er, sorry if I use incorrect terminology, I am new at this. What I mean is the "Play" button, at the top left. At school, I've used a different tool for writing script, MonoUtility. But i downloaded a unity package for my laptop, and it came with a different scripting tool, Virtual Studio Community. Like I said, still pretty dumb about it, but I usually carefully enter one or two lines of script, then hit the play button to make sure there are no errors. (my professor would probably refer to this as "running" it.) But whatever I open in VSC on my laptop, the play button is greyed out. I have also tried navigating to the "Build" dropdown menu, and tried to Build All, but the entire drop down is greyed out.
     
  4. Disc_Pistol

    Disc_Pistol

    Joined:
    Jun 15, 2018
    Posts:
    23
    OK, I searched for updates a few more times, and the issue resolved. Thanks for the help!
     
  5. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Hmm. Maybe post a screenshot of the Play button you're talking about?

    It sounds like Unity isn't synchronizing with Visual Studio, though. Within Unity, if you double-click on a c# script, does it open that script in Visual Studio?
     
  6. rrtenz

    rrtenz

    Joined:
    Aug 23, 2019
    Posts:
    2
    I got mine to work by going to Preferences -> External Tools, verifying I was using the correct External Script Editor, and then pressing the "Regenerate project files" button
     

    Attached Files: