❔ 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
Post your code and any errors you have
Thats my code and the errors I have
you have 2
Character
classesWich one should i delete
how should we know?
Where is the other Caracter?
also impossible for us to know
or where did i code this
What other scripts do you have
2
other scripts
but is only one for this Charcter
I deleted the other script but now it has another error
but why it has an GetComponent
the GetComponent exists why is that an error😢
can you please just share the code where this occurs...
we can't just guess
Thats the code
Do you know now?😅
i don't, sorry. i don't do unity
ok
try
rb = gameObject.GetComponent<Rigidbody>();
That doesn`t work
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
classesweird it inherits from here
it's a common mistake
it's likely you have another same script in your project
It works the MonoBehavior was the problem
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
Thank you so much guys😁
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.