❔ I need help for my Game

Can everyone help me with my game for my school project, I need help with the scripting? My Code doesn`t work.
29 Replies
Thinker
Thinker3y ago
Post your code and any errors you have
simonfendt211
simonfendt211OP3y ago
simonfendt211
simonfendt211OP3y ago
simonfendt211
simonfendt211OP3y ago
Thats my code and the errors I have
ero
ero3y ago
you have 2 Character classes
simonfendt211
simonfendt211OP3y ago
Wich one should i delete
ero
ero3y ago
how should we know?
simonfendt211
simonfendt211OP3y ago
Where is the other Caracter?
ero
ero3y ago
also impossible for us to know
simonfendt211
simonfendt211OP3y ago
or where did i code this
Thinker
Thinker3y ago
What other scripts do you have
simonfendt211
simonfendt211OP3y ago
2 other scripts
simonfendt211
simonfendt211OP3y ago
but is only one for this Charcter
simonfendt211
simonfendt211OP3y ago
I deleted the other script but now it has another error
simonfendt211
simonfendt211OP3y ago
but why it has an GetComponent the GetComponent exists why is that an error😢
ero
ero3y ago
can you please just share the code where this occurs... we can't just guess
simonfendt211
simonfendt211OP3y ago
Thats the code
simonfendt211
simonfendt211OP3y ago
Do you know now?😅
ero
ero3y ago
i don't, sorry. i don't do unity
simonfendt211
simonfendt211OP3y ago
ok
TheRanger
TheRanger3y ago
try rb = gameObject.GetComponent<Rigidbody>();
simonfendt211
simonfendt211OP3y ago
That doesn`t work
Thinker
Thinker3y ago
If you look at the script on the right, the Character does not inherit from MonoBehavior Again you for some reason seem to have two Character classes
TheRanger
TheRanger3y ago
weird it inherits from here
Cattywampus
Cattywampus3y ago
it's a common mistake it's likely you have another same script in your project
simonfendt211
simonfendt211OP3y ago
It works the MonoBehavior was the problem
Cattywampus
Cattywampus3y ago
OR you have the same class BUT the name of the file is different than the name of the class in it which also probably has the same class name as your other script in Unity for MonoBehaviors you can't have a class name different than the file.cs name
simonfendt211
simonfendt211OP3y ago
Thank you so much guys😁
Accord
Accord3y 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.

Did you find this page helpful?