❔ Why is there no color

Can i ask why some of my code isn't like turning blue or red or purple etc. Cuz i'm getting an error of void not being a valid token and im assuming this is the problem
16 Replies
Hackmagician
Hackmagician2y ago
What editor are you using? ah
Bepool 🍟
Bepool 🍟OP2y ago
vs code
Hackmagician
Hackmagician2y ago
You need semicolons after myRigidBody; You need to end lines with a semicolon in C#
Bepool 🍟
Bepool 🍟OP2y ago
oh mb i forgot that but why doesn't void Start have no color?
Hackmagician
Hackmagician2y ago
because it thinks its a part of the lines above also you can't do public class RigidBody2D myRigidBody
Bepool 🍟
Bepool 🍟OP2y ago
oh sorry i just got mixed up oh there we go it works now
Hackmagician
Hackmagician2y ago
youre calling it a class and not even having {} for the class bo dy alright 👍
Bepool 🍟
Bepool 🍟OP2y ago
thanks
Hackmagician
Hackmagician2y ago
No problem
Thinker
Thinker2y ago
Btw it's generally recommended to use Visual Studio and not VSCode for Unity
FusedQyou
FusedQyou2y ago
The main issue seems to not be resolved by anybody, which is that you ened to configure your editor to work with Unity Only then does it make sense to comment on code style and/or syntax errors, considering the editor does that for you Steps to set up VSCode: https://code.visualstudio.com/docs/other/unity Steps to set up VS2022: https://learn.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/getting-started-with-visual-studio-tools-for-unity?pivots=windows#install-unity-support-for-visual-studio I would recommend you switch to VS2022 Community edition as VSCode is not properly supported, and will not be properly supported ever. @bepool
Monsieur Wholesome
Given that MonoBehaviour is coloured and recognized as a class, and the syntax highlighting only fails after the faulty syntax, I think it wasnt a problem to begin with
FusedQyou
FusedQyou2y ago
The editor would inform of the faulthy code, so it is in fact not properly configured. I never understood how VSCode could be in a state where it recognises c# + Unity, but does not highlight syntax, but it in fact is a possibillity One of the many reasons why I suggest VS2022 over VSCode
Hackmagician
Hackmagician2y ago
🤔
Accord
Accord2y 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