Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Visual studio for Unity, how can i detach it to run the file? #84

Closed
akamegakira opened this issue Jul 21, 2023 · 8 comments
Closed

Comments

@akamegakira
Copy link

I have been using visual studio only for unity, and when i want to run the script, i only have the option "attach" next to the green triangle.
Does anyone know how to fix it?

@mcthouacbb
Copy link

Did you open the project by double clicking the solution file(Chess-Challenge.sln)? If not, try doing that.

@akamegakira
Copy link
Author

akamegakira commented Jul 21, 2023

No, but now i did and it works. Its the first time i participate in something like that :)
Thanks!

@CharlesBeverly
Copy link

Did you open the project by double clicking the solution file(Chess-Challenge.sln)? If not, try doing that.

Im having the same problem, but when opening the project through the Chess-Challenge.sln it simply brings up a blank Vs code screen that does nothing, how is it supposed to work and how is one supposed to properly build and run their code, the directions on the read me simply read "build and run" without any further instructions and being new to the area this is very hard to understand

@ufrshubham
Copy link

ufrshubham commented Jul 22, 2023

it simply brings up a blank Vs code screen that does nothing,

@CharlesBeverly You need to use Visual Studio. VS and VSCode are two very different software packages. There are ways to make this work with VSCode too (see #85), but using VS will just reduce the friction.

@ufrshubham
Copy link

@akamegakira if your original problem has been resolved can you close this issue?

@akamegakira
Copy link
Author

@ufrshubham i have the same thing, but i am new too, so i supposed that this is how it was supposed to be since if i press the triangle it runs. Are we certain that a .sln file should have something appearing as a code file?
Sorry i cant help, i am a newbie😅.

@akamegakira
Copy link
Author

@ufrshubham i finally think i had success!!!
The thing is that as i understand it, a .sln file is the environment, much like unity.
So what you can then do is open the other scripts after you have the sln file opened and you will have the scripts to run inside the desired environment.
so in essence:

  1. open the sln file and leave it running
  2. open any script you want from the challenge and modify it
  3. press the triangle that now says chess-challenge

the code is stored in the .cs files, so you can change and read whatever you want
But remember we are to only submit the MyBot.cs script

@ufrshubham
Copy link

ufrshubham commented Jul 22, 2023

@akamegakira glad that you figured it out. Here are few more details about .sln.

Visual Studio is not just a code editor, it has a lot more features to it. It be used to open and modify a single file, but in most cases any kind of application is made up of multiple files. For example, a Unity project consists of multiple Scriptable Objects, Prefabs, Scenes, etc, you get the point.

Similar to that an application written in C# also consists of multiple C# files (aka source code or code base or project). To make it easier to maintain, build and debug this source code, you use IDEs (integrated development environment). Visual Studio is one of such IDEs. To open a project, an IDE needs to know all the files, their locations, their type and a million other things. All this information is stored in IDE specific project files. For Visual Studio, .sln is that project file (there are a few more too, but sln is the most important one).

Btw, sln stands for Solution and a single solution can contain multiple projects too. Also, this is not specific to just a C# project, any kind of project created with Visual Studio will have a solution file. I might have oversimplified things but you get the gist of it 😄. More details about Visual Studio solution can be found here.

Also, this is very common for a lot software packages. For example,

  • Unreal uses .uproject
  • Godot uses .godot

In context of Unity, it creates a Visual Studio solution for all your C# scripts. And it does a very good job of abstracting all the Visual Studio specific things from the users. It is good for newbies, but then it also results into producing game developers that can make games using Unity C# without fully understanding the C# and .Net part of things. Its kind of a double edges sword 😉.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants