why am i getting the CS0246 error on unity for this code?
please help! im new to coding and i cannot figure this out

44 Replies
What is CS0246?
"The type or namespace name 'gameObject' could not be found (are you missing a using directive or an assembly reference?)"
btw:

?
C# is case-sensitive
And
;
terminates a statementoh
your entire editor is not configured
Also, wrong order:

$configureunity
You have a syntax error in the code which suggests you don't have your editor configured. You need to configure it before you do anything Unity related.
:bulb: IDE Configuration If your IDE is not autocompleting code or underlining errors, please configure it. Select one: • :visualstudio: Visual Studio (Installed via Unity Hub) • :visualstudio: Visual Studio (Installed manually) • :vscode: VS Code • :jetbrains: JetBrains Rider • :question: Other/None
It's
type name
not name type
:f_bruh:
but then its just the same error backwards
?
The type or namespace name 'BulletImpactEffectPrefab' could not be found (are you missing a using directive or an assembly reference?)
Well, do you have a
BulletImpactEffectPrefab
class?
Is the namespace it's in imported?i dunno where would i see that
So you're trying to use a class you don't know even exists?
wait like in what, the code or the project
You're trying to use
BulletImpactEffectPrefab
What is it?
Does it exist?yeah
If so, where does it exist?
Do you have a
public class BulletImpactEffectPrefab
?i have public class GlobalReferences : MonoBehaviour
So you do not have a class
BulletImpactEffectPrefab
anywhere?oh no i dont i only had public BulletImpactEffectPrefab gameObject
So you're trying to use a thing that does not exist
😦
I assume you don't have a purple pressure washer in your room right now
Try to use a purple pressure washer, then
Can't do that, can you?
what is that
no
So, if you have no
BulletImpactEffectPrefab
class
How can you hope to use it?i dunno i just started coding yesterday i still dont understand much
$helloworld
Start from the basics, then, instead of jumping straight into Unity
ive already done like most of the basics
Must've missed a chapter on "you can't use things that don't exist", and a "C# is case-sensitive and semicolons terminate statements, also the order is
type name
not name type
" one
Also, go and do what Ero said, set up your editor to work with Unity properly
That way the editor will yell at you when something's wrong, highlighting the errors, instead of tou having to run it firstdo i have to like reinstall it to do that cuz i dont see modify anywhere
You're using Visual Studio 2022?
i dunno
Or Visual Studio Code?
Or Rider?
vs code
Okay, so VS Code != Visual Studio

ohhhhhhhhh i didnt see that
thanks for all the help
gameObject
is a property from the base class