Hello. Im trying to insert a script to an object (its rotation control for the mouse). I keep getting a message saying the script class cannot be found.
Ive tried restarting unity, i have no compiler errors, ive copied the script into a new script file.
I’m fairly new to game engines so I would really appreciate some help. Thanks!
If your class name is “ThisIsAnAwesomeScript”
Then your script filename must also be “ThisIsAnAwesomeScript”
Letter for letter, caps matter, etc. Also, no spaces.
You also don’t want to try to put multiple MonoBehavior scripts under the same file. It doesn’t work that well either if you are trying that. (not saying you are, just pointing that out as well.)
Thanks for your help. Ive got the script working now. i can insert it to the object. however it doesn’t seem to work when testing. its to control the object with the mouse. Is this correct? Thanks again for your help.
Are you familiar with Debug.Log? Add debugging to figure out where the problem is occurring. It could be OnMouseDrag() is not even being called. It could be X/YaxisRotation are not values you expect. It could be you don’t have axis with those specific names defined in the Input Manager (is the plural of “axis” also just axis? axii? axises? ). It could be the script is attached to the wrong gameobject, making transform a reference to again the wrong gameobject’s transform. It could be any number of things.
I am aware of it but never used it. i believe the the plurals are the same “axis”. ive tried another script that works perfect now. however the mouse control inverts when i switch to iether half of the screen which makes it tricky to move around the object. thankyou for your help so far. if you have a suggestion for solving the inversion that would be great otherwise dont worry.