C
C#16mo ago
MrPlayz24

❔ why isnt this code not highlighting as shown in yt

65 Replies
MrPlayz24
MrPlayz2416mo ago
pls help anyone and the code dosent work to Picture 1*
Terria
Terria16mo ago
have you installed a C# extension?
MrPlayz24
MrPlayz2416mo ago
what u mean
Terria
Terria16mo ago
oh wait
MrPlayz24
MrPlayz2416mo ago
the code is done in Visual studio
Terria
Terria16mo ago
alright, okie.. I just thought its vscode
MrPlayz24
MrPlayz2416mo ago
no so also when i try to run code
Denis
Denis16mo ago
Not sure whether it is applied implicitly, but shouldn't you have a namespace declaration at the top of the file?
MrPlayz24
MrPlayz2416mo ago
hmm
Terria
Terria16mo ago
you have a C# workload component installed? from the VS Installer?
MrPlayz24
MrPlayz2416mo ago
i dont think so
Terria
Terria16mo ago
that's probably why you wouldn't have a correct highlighting
MrPlayz24
MrPlayz2416mo ago
but in youtube video they did not declare namespace but still worked does highlighting interfere with like when code is running?
Terria
Terria16mo ago
nope actually, but it might help see you why the code is not running
MrPlayz24
MrPlayz2416mo ago
oh
justaeris
justaeris16mo ago
no it doesn't but if this means you don't have the C# workload, your code won't probably run
Terria
Terria16mo ago
also, are you sure do you install them?
MrPlayz24
MrPlayz2416mo ago
oh wait i thinl i did not install Game dev with unity
Terria
Terria16mo ago
checks those what I check, and you'll be alright
MrPlayz24
MrPlayz2416mo ago
wait how do i acess The workload page
Terria
Terria16mo ago
goto Visual Studio Installer Modify and you will see the screen like this
MrPlayz24
MrPlayz2416mo ago
got it
Terria
Terria16mo ago
you also don't forget to check the .NET desktop development as well, you need that too, I think
MrPlayz24
MrPlayz2416mo ago
i check it before
Terria
Terria16mo ago
alright catcorn
MrPlayz24
MrPlayz2416mo ago
im new to VS and C# so.. and Unity anyways thx guys
Terria
Terria16mo ago
your welcome catpat
MrPlayz24
MrPlayz2416mo ago
hmm it works but the highlighting did not apply
Terria
Terria16mo ago
that's weird, but can you hover on the text (or some function) if it does gives an information? and also does errors also shows as well? it's just probably an editor visual bug
MrPlayz24
MrPlayz2416mo ago
there is no visible error
Terria
Terria16mo ago
erm, maybe restart the VS?
MrPlayz24
MrPlayz2416mo ago
yes it does hmm ok
Thinker
Thinker16mo ago
$unity
MrPlayz24
MrPlayz2416mo ago
still dosent apply
Thinker
Thinker16mo ago
wait nvm sorry
MrPlayz24
MrPlayz2416mo ago
stays the same ive joined it already
Thinker
Thinker16mo ago
$unityvs
Thinker
Thinker16mo ago
I swear there was a tag for it
Terria
Terria16mo ago
so, VS Unity workload shouldn't be installed right now?
Buddy
Buddy16mo ago
$unitybug
MODiX
MODiX16mo ago
If intellisense is not working for VSCode / Visual Studio, follow these steps.
Go into Unity Editor -> Preferences -> External Tools -> Set Visual Studio (or Visual Studio Code) as your preferred editor.
Go into Unity Editor -> Preferences -> External Tools -> Set Visual Studio (or Visual Studio Code) as your preferred editor.
Close the editor and re-open it again by double-clicking a script file.
Buddy
Buddy16mo ago
This is the reason As Unity is dumb that it doesn't detect (and set) Visual Studio if VS is installed after Unity.
Terria
Terria16mo ago
Unity being Unity
MrPlayz24
MrPlayz2416mo ago
sheesh where is External tools
Buddy
Buddy16mo ago
In Preferences Unity Editor itself
Buddy
Buddy16mo ago
MrPlayz24
MrPlayz2416mo ago
? oh so
MrPlayz24
MrPlayz2416mo ago
MrPlayz24
MrPlayz2416mo ago
should i click ti should i click regenrate project files i click it
Buddy
Buddy16mo ago
no But you can try Sometimes that can also be it
Buddy
Buddy16mo ago
But it should work if you have this set to whatever code editor you want to use
Buddy
Buddy16mo ago
And then exit the editor then double-click a file in Project it should be highlighted.
MrPlayz24
MrPlayz2416mo ago
hm so do i restart unity and vs wait it works thx anyways
MrPlayz24
MrPlayz2416mo ago
MrPlayz24
MrPlayz2416mo ago
was the code i did is in right way? like 4 if statements or can it be simplified
Thinker
Thinker16mo ago
can't really be simplified
Terria
Terria16mo ago
can still be simplified with Axis, but I think the current code is good for beginners
MrPlayz24
MrPlayz2416mo ago
yea im a beginner so what project do you recommend i do 2d or 3d
Monsieur Wholesome
no, unity scripts are based on global classes
Buddy
Buddy16mo ago
Use new Input System old one is absolutely shit If you want to play on a controller, you have to map the action for each control manufacturer (Xbox, Playstation) and so on.
MrPlayz24
MrPlayz2416mo ago
Uh can you give an example please
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts