Having some crazy errors, First time with C# Trying to mess with unity
Error CS0106 The modifier private is not valid for this item.
Been having a couple issues with my code, Im a beginning just trying to practice some C# And try to get a movement system down for unity, Followed an instruction...And suddenly im stuck with a whole ton of errors. Sorry if its late, But I need to make progress on this or ill never get around to finishing it
62 Replies
Probably would be better to screen shot the error and the code so ill do that now one second!
void
not Void
C# is case-sensitiveOh its cause I did caps uhhhgggg
Looks like that fixed two of the erros!
Any thoughts on the not valid errors?
Misplaced braces
You close the class after field declarations
Really? Huh, Cant tell which ones screwed...
Oh I thought...
Shit
$structure
It looks like the brace is closed...I apologize, Im really braindead. Especially since this is my first time really diving into C#
Im trying to understand
It is closed, but too early
Oh? So dont put the brace there?
Makes it so the methods are not a part od it
So should I add that brace to the end of the code? Oh up to a certain part
*or
Add the closing brace at the end of the class
Oh god getting hit with that "What?" from a coder def hurts
ah yes... unity
"What?" as in "what is this bit, it's not a part of the class"
Not as in "wtf are you doing" lol
Oh ok sorry
Ok let me try it, Ill update you and you can inform me of how dumb I am
Formatting the code properly helps you spot errors like those. If a method is on the same indentation level as a class, you can tell at a glance that it's not a part of it
$prettycode is helpful here
To format your code in Visual Studio, Visual Studio Code, Rider, use the following shortcut:
NOTE: the first key must be held while doing it.
https://cdn.discordapp.com/attachments/569261465463160900/899513918567890944/2021-10-18_01-26-35.gif
Oh boy
Well all the brackets in between turned purple
Good
Good?
In VS, brackets change color as indentation level changes
Gooot it
So now it tells you those methods (purple) are part of this class (yellow)
If you add an
if
or whatever in a method, the braces will be another color yetAlright...So were getting somewhere
And three more errors popped up
_(;-;)_/
Different errors is progress lol
I mean
True
Again, case-sensitivity
Inputsystem
is not the same as InputSystem
system.collections.generic
is not System.Collections.Generic
And so on
Seems like VS is not showing any of those issues inline. Probably doesn't give you any autocomplete either. Did you set Unity and VS up correctly for them to work together?Install & configure Visual Studio Tools for Unity
Connect Unity and Visual Studio and use Visual Studio Tools for Unity to support writing and debugging for cross-platform development.
I think I can only offer a slow shrug on that part, Something did break mid way through
And It told me I needed SDK
When I downloaded it it...Didnt do anything
This output could probably give answers but it doesnt do anything for me
Those are messages from VS Code
In your screenshots, it's VS
Alright yeah its visual studio
Is that an issue?
No, you should be using Visual Studio
Visual Studio Code is a fair bit less powerful and harder to use overall
Oh
So just make sure VS has the Unity workload installed, Unity has the VS plugin, and everything should work fine
As per the docs I linked
I think I installed the unity VS Plugin, Did it just a bit ago following a tutorial
So im not totally sure why that wouldnt be working let me check it out
yeah its in
But from what I gather from what you said a bunch of stuff is caps when it shouldnt be, So im gonna look it over
Entered this and it actually cleared half the errors, Now I have what looks like some...Probably basic errors. No longer having the private error which is just golden. Now its just having problems with wording I..Think
1 and 3 are a casing issue again
It really would be much easier if you had the tooling set up properly
What is a casing issue, Like...Lowercase and uppercase?
Yes
Alright thank god
Tooling should be set up but Im not sure why it isnt working
Read the docs I linked
My PC Is an anomoly from the void that cannot be understood so it doesnt suprise me
Go step by step
See if everything is set up as the docs say
Alright I appreciate the help, Ill update if I find anything. Ill go over the doc
Well I pretty much fixed all the errors!
Which sounds...Kinda good, Until you realizer this is me coding. Went through the doc did what it said and...Didnt seem like anything changed. Went through and cleaned up the cript and...Well
Not sure what the hell happened, Might be specifically cause somethings missing
I also had the idea to just...Sit and read through all the bits and pieces of the code. Which resulted in me finding random numbers scattered in it. A great example which is suprising that it took long enough to spot is.
Onfoot1
Which busted a bunch of the code and I couldnt find out where It came from
Nevermind entered one bit of code everything fixed
Chad shit
if you see any errors inside your package cache in unity, most probably they're just bogus errors, forcing hot-reloading or restarting your editor will automatically regenerate those cache mismatches while in edit mode.
Thats fair! I just ran into a new thingy, That I cant quite make sense of. When I hit play and try to move the capsul around, I get this
Which is a bit new
Not sure why its coming about now...
Seems like some internal error from Unittm something wrong with their PlasticSCM code
Oh god
Uhg
I dont even know how to fix that
this is a better approach than copy pasting from chat gpt
@ZZZZZZZZZZZZZZZZZZZZZZZZZ I apologize for bothering, I debugged a lotta stuff. And I worked. on it a good bit...However for some reason im unable to do any movement options. Meaning I input key, It reads key. And it doesnt move.
Im unsure what I did now its saying this again