- Home /
Can't add script
I can't apply script on object. "Can't add script can't add component 'globalVar' because it doesn't exist" The same thing with standart scripts too. My friend has the same unity. Everything works fine on his computer, so I think there is no errors in script. Can anyone help me?
\My friend can apply this script on object without problems. \There are 4 scripts for making inventory. \Global var is one of them. \ Third line :" Stores global variables" \ Fourth line: " Apply on any unchangeable object I have downloaded it from one lesson on youtube. Firstly, the guy just dragged the script on a cube as an example.
show your script otherwise we don't know how to fix it
is your script called "GlobalVar" or is it called "GlobalVar Import Settings"? The saved as name of the script & the name of the class need to be the same.
$$anonymous$$y script is called GlobalVar. I don't know why, but inspector calls it "GlobalVar Import Settings"
Thats not a problem. Ur script name is "GlobalVar" only.
Answer by Shamini · Aug 11, 2014 at 10:57 AM
have you changed the name of the script.because you have mentioned the name 'globalVar' whereas the name of the class inside the script is 'GlobalVar'.your class name and name of the script must be the same.